Skip to content

Instantly share code, notes, and snippets.

@Tatsh
Tatsh / README.md
Last active January 23, 2020 03:49
Automate transferring of repositories from one user to another.

How to use

  1. Change OLD_USER to the current owner of the repositories to transfer.
  2. Change NEW_USER to the new owner.
  3. Change REPOS to be an iterable of repository names (str) to transfer.
  4. Transfer one repository normally through the web browser, because you need to type your password once (this only lasts for a few hours).
  5. Extract cookies from the browser after signing into GitHub. Save in Netscape format in cookies.txt in the same location as the script. On every line in cookies.txt that starts with 'github.com' change it to '.github.com'.
  6. python gh-transfer.py because the API does not have this feature!

You can extract cookies from Chrome in Netscape format with EditThisCookie.

@Tatsh
Tatsh / fibseq.spl
Created December 7, 2019 10:17
Maybe working fibonacci algorithm in Shakespeare language.
Fibonacci Sequence.
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ghost, another character.
Ophelia, flatterer.
Act I: The one.
Scene I: Zero.
#!/usr/bin/env bash
set -e
SIGNING_IDENTITY='iPhone Distribution: Andrew Udvare (EU5R2QY9HJ)'
mkdir -p ~/dev/retroarch
cd ~/dev/retroarch
if ! [ -d retroarch ]; then
git clone https://github.com/libretro/RetroArch.git retroarch
fi
@Tatsh
Tatsh / ldmacclientuninstall.sh
Created March 29, 2019 20:24 — forked from ferment/ldmacclientuninstall.sh
Remove LANDESK from OSX / macOS
#!/bin/sh
#
function killAllProcs( )
{
sudo /usr/bin/killall $1
/bin/ps ax | /usr/bin/grep $1|/usr/bin/awk '{print $1}'|/usr/bin/xargs sudo kill -9
}
echo "removing LANDesk Client"
@Tatsh
Tatsh / github-no-discover.user.js
Last active March 28, 2019 05:40
Hide the Discover section in >= 1012px view
// ==UserScript==
// @name No Discover
// @homepage https://gist.github.com/Tatsh/d1b5a039d6f511c95a08daade8b07a81
// @namespace https://tat.sh
// @version 0.0.5
// @description Hide the Discover section in >= 1012px view.
// @author Tatsh
// @match https://github.com
// @grant none
// @run-at document-end
@Tatsh
Tatsh / qsort.js
Last active July 14, 2020 17:20
Single-expression qsort() implementations
const sorted = (xs) =>
xs.length < 2
? xs
: sorted(xs.slice(1).filter((x) => x < xs[0])).concat(
[xs[0]],
sorted(xs.slice(1).filter((x) => x > xs[0]))
);
@Tatsh
Tatsh / smallest-in-array-positive.js
Last active July 28, 2018 13:43
Demo test question on Codility.
const sorted = (a) => Array.prototype.sort.call(a, (a, b) => a - b);
const tail = (n, a) => Array.prototype.slice.call(a, n);
const abs = Math.abs;
const solution = (a) => {
const sa = sorted(a);
let last = abs(a[0]);
for (const x of tail(1, sa)) {
const negative = x < 0;
@Tatsh
Tatsh / quassel-format.py
Created June 25, 2018 01:10
Use new Python template syntax to format text in Quassel.
#!/usr/bin/env python
from argparse import Namespace
from string import Template
import sys
Codes = Namespace(
Bold=chr(2),
Color=chr(3),
Normal=chr(15),
Underline=chr(31),
import {
append, compose, curryN, join, length, partialRight, prepend, repeat, subtract,
} from 'ramda'
const pad = (str, n, char = ' ', _f = append) => compose(join(''), _f(str), repeat(char), subtract(n), length)(str)
const padStart = curryN(3, pad)
const padEnd = curryN(3, partialRight(pad, [prepend]))
@Tatsh
Tatsh / delall-icloud-photos.py
Last active December 17, 2023 03:40
Use pyicloud to delete all photos from iCloud (may need to be run multiple times)
#!/usr/bin/env python
from __future__ import print_function
import json
import sys
from authentication import authenticate
from future.moves.urllib.parse import urlencode
if __name__ == '__main__':
username = sys.argv[1]