From | To | Expression |
---|
This file contains hidden or 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
import java.io.*; | |
import java.lang.Math; | |
public class Temporal_Noise { | |
public static void main(String[] args) { | |
Temporal_Noise tn = new Temporal_Noise(); | |
tn.run(null); | |
} | |
public void run(String dir_name) { | |
if (dir_name == null) |
This file contains hidden or 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
import collections | |
import itertools | |
def last(iterable, deque=collections.deque): | |
return deque(iterable, maxlen = 1)[0] | |
def iterlen(iterable): | |
return sum(1 for _ in iterable) | |
def droptake(iterable, takecondition, dropcondition = None, |
This file contains hidden or 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
from __future__ import with_statement | |
from heapq import heapify, heappop, heappushpop | |
from itertools import count | |
from mmap import mmap | |
try: | |
from collections import Counter | |
except: | |
def Counter(iterable): | |
frequencies = __import__('collections').defaultdict(int) | |
for item in iterable: |
This file contains hidden or 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
from __future__ import print_function, division | |
from math import ceil | |
from operator import xor, getitem | |
from functools import reduce | |
from struct import unpack, pack | |
two64 = 0x10000000000000000 | |
def hexToBytes(hexes): | |
hexes = hexes.replace(' ', '') | |
return bytes(int(hexes[i:i+2], 16) for i in range(0, len(hexes), 2)) |
This file contains hidden or 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
from collections import OrderedDict | |
class OrderedSet(object): | |
def __init__(self, iterable = None): | |
self.storage = OrderedDict() | |
if iterable: | |
self.storage.update((elem, True) for elem in iterable) | |
def __contains__(self, elem): | |
return elem in self.storage | |
def __iter__(self): | |
return iter(self.storage) |
This file contains hidden or 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
from __future__ import print_function | |
from collections import defaultdict | |
import functools | |
def Y(f): | |
@functools.wraps(f) | |
def Yf(*args): | |
return inner(*args) | |
inner = f(Yf) |
This file contains hidden or 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 | |
#from tkFileDialog import askopenfilenames | |
from tkinter.filedialog import askopenfilename | |
import os, os.path | |
from itertools import chain, repeat | |
from operator import itemgetter, sub, pow, truediv | |
from array import array | |
from math import sqrt | |
from sys import argv |
This file contains hidden or 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
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
This file contains hidden or 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
class TransposedMatrix(object): | |
def __init__(self, matrix, index = None): | |
self.matrix = matrix | |
self.index = index | |
def __getitem__(self, index): | |
if self.index is None: | |
return TransposedMatrix(self.matrix, index) | |
return self.matrix[index][self.index] |
OlderNewer