Skip to content

Instantly share code, notes, and snippets.

import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = 'http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=json&fl=original&collapse=urlkey' % host
else:
url = 'http://web.archive.org/cdx/search/cdx?url=%s/*&output=json&fl=original&collapse=urlkey' % host
@stemid
stemid / make_backup.sh
Created June 25, 2018 12:30
Backup script for my personal laptop
#!/usr/bin/env bash
# Simple backup script for borg. http://borgbackup.readthedocs.io/en/stable/
# Install on Fedora: sudo dnf install borgbackup
#
# Configure BORG_REPO below to match some path on your own system. In my case
# it points to an autofs mount on my network backup device.
# Configure your own borg_excludes.
# by Stefan Midjich <swehack at gmail dot com>
export BORG_REPO="/media/nas/backups/$(hostname -s)-borgbackup"
@OrionReed
OrionReed / DOM3D.js
Last active March 29, 2024 10:31
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@bryanbuchanan
bryanbuchanan / GetShapeArea.jsx
Last active March 29, 2024 10:27
Script to find the area of shapes in Adobe Illustrator
/* Save this file with a jsx extension and place in your
Illustrator/Presets/en_US/Scripts folder. You can then
access it from the File > Scripts menu */
var decimalPlaces = 3;
if (app.documents.length > 0) {
if (app.activeDocument.selection.length < 1) {
alert('Select a path');
@TABASCOatw
TABASCOatw / solana_repositories.json
Created May 5, 2023 19:10
Indexed Solana Repositories April 2023 (expect 2% false positives)
{
"chainify": "https://github.com/liquality/chainify",
"solana-chat-app": "https://github.com/jsoneaday/solana-chat-app",
"wallet-adapter": "https://github.com/solana-labs/wallet-adapter",
"audius-protocol": "https://github.com/AudiusProject/audius-protocol",
"raydium-ui": "https://github.com/raydium-io/raydium-ui",
"espresso-cash-public": "https://github.com/espresso-cash/espresso-cash-public",
"backpack": "https://github.com/coral-xyz/backpack",
"projects": "https://github.com/solidproof/projects",
"protocol-v1": "https://github.com/drift-labs/protocol-v1",
@ZipFile
ZipFile / README.md
Last active March 29, 2024 10:26
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active March 29, 2024 10:25
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@shitchell
shitchell / git-user-stats
Last active March 29, 2024 10:23
Show user stats in a git repo
#!/bin/bash
#
# Show user stats (commits, files modified, insertions, deletions, and total
# lines modified) for a repo
git_log_opts=( "$@" )
git log "${git_log_opts[@]}" --format='author: %ae' --numstat \
| tr '[A-Z]' '[a-z]' \
| grep -v '^$' \
@jtadeulopes
jtadeulopes / server.md
Last active March 29, 2024 10:23
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@jiahao87
jiahao87 / pegasus_fine_tune.py
Last active March 29, 2024 10:20
Pytorch script for fine-tuning Pegasus Large model
"""Script for fine-tuning Pegasus
Example usage:
# use XSum dataset as example, with first 1000 docs as training data
from datasets import load_dataset
dataset = load_dataset("xsum")
train_texts, train_labels = dataset['train']['document'][:1000], dataset['train']['summary'][:1000]
# use Pegasus Large model as base for fine-tuning
model_name = 'google/pegasus-large'
train_dataset, _, _, tokenizer = prepare_data(model_name, train_texts, train_labels)