Skip to content

Instantly share code, notes, and snippets.

Tatsh

Block or report user

Report or block Tatsh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Tatsh
Tatsh / mutable_list_plugin.py
Last active Feb 3, 2020
Start of a Pylint plugin to check for lists that have never been mutated, and could therefore be a tuple or other immutable type.
View mutable_list_plugin.py
from typing import Dict, List, Optional, Union
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter
import astroid
from astroid.scoped_nodes import FunctionDef
@Tatsh
Tatsh / README.md
Last active Jan 23, 2020
Automate transferring of repositories from one user to another.
View README.md

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 Dec 7, 2019
Maybe working fibonacci algorithm in Shakespeare language.
View fibseq.spl
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.
View build-retroarch-ios.sh
#!/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 Mar 29, 2019 — forked from ferment/ldmacclientuninstall.sh
Remove LANDESK from OSX / macOS
View ldmacclientuninstall.sh
#!/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 Mar 28, 2019
Hide the Discover section in >= 1012px view
View github-no-discover.user.js
// ==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 Dec 3, 2018
Single-expression qsort() implementations
View qsort.js
const sorted = xs => xs.length <= 1 ? 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 Jul 28, 2018
Demo test question on Codility.
View smallest-in-array-positive.js
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 Jun 25, 2018
Use new Python template syntax to format text in Quassel.
View quassel-format.py
#!/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),
View padStart.js
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]))
You can’t perform that action at this time.