This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def modinv(n, mod): | |
t, w, r = 0, 1, mod | |
while n: | |
(q, n), r = divmod(r, n), n | |
t, w = w, t - q * w | |
if r > 1: raise Exception('not invertible ' + repr(n)) | |
if t < 0: t += mod | |
return t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write -g ApplePressAndHoldEnabled -bool NO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import numpy as np | |
from PIL import Image | |
def conway(): | |
size = (421, 1263) | |
iterations = 19780 | |
data = np.random.randint(0, 2, size, dtype=np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# From: https://github.com/cielavenir/flashupdate/ | |
#Note: use for installing to ~/Library or updating globally. | |
#New global installation should use normal installer. | |
if [ `whoami` == "root" ];then | |
export HOME="" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <bigd.h> // http://www.di-mgt.com.au/bigdigits.html | |
using namespace std; | |
namespace paiv | |
{ | |
typedef uint32_t u32; | |
class Big | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MathCalc: a parser for basic mathematical expressions | |
// From here: https://paiv.github.io/blog/2016/03/23/js-calc.html | |
// | |
// | |
// Copyright (c) 2016, Pavel Ivashkov, github.com/paiv | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above | |
// copyright notice and this permission notice appear in all copies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
mkdir -p "source" | |
curl -RL# "https://class.coursera.org/ml-005/lecture/download.mp4?lecture_id=[1-114]" -o "source/lecture#1.mp4" | |
rm "source/lecture94.mp4" | |
mkdir -p "fixed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
typedef unsigned short u16; | |
typedef unsigned int u32; | |
typedef int s32; | |
typedef wchar_t wc; | |
static s32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
FILE=$1 | |
TEMPFILE=`mktemp` | |
cat > "$TEMPFILE" <<'LicenseText' | |
/* | |
* Copyright (c) <year> <copyright holders> | |
* |