Skip to content

Instantly share code, notes, and snippets.

lst1 = list(str1)
lst2 = list(str2)
for char in lst1:
if char in lst2:
count += 1
lst2.remove(char)
return count
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 6 --transparent true --alpha 0 --tint 0x000000 --height 16 &
@codyhan94
codyhan94 / gist:7403935
Created November 10, 2013 21:04
Keybindings to increase and decrease volume in xmonad
, ((mod4Mask .|. controlMask, xK_j), spawn "amixer set Master 5%-")
, ((mod4Mask .|. controlMask, xK_k), spawn "amixer set Master 5%+")
int array[];
int prev2 = array[0];
int prev1 = array[1];
int sum_prev = prev1 + prev2;
bool seg_good = true;
for (int i = 2; i < n; ++i)
{
int cur = array[i];
if (cur == sum_prev)
int f(const vector<int> &x)
{
int longest = 2;
int p = 0;
int q = 0;
while (q < x.size())
{
int len = q - p + 1;
if (admissible(x, p, q))
{
ans3 = Import["Anscombe3", "Table", "HeaderLines" -> 1];
ansModel = LinearModelFit[ans3, x, x];
residuals = ansModel["FitResiduals"]
KolmogorovSmirnovTest[residuals]
KolmogorovSmirnovTest[residuals, NormalDistribution[]]
a=read.table("Anscombe3", header=TRUE)
model=lm(formula=y~x, data=a)
e=residuals(model)
ks.test(e, pnorm)
ages = {40, 34, 23, 40, 31, 33, 49, 33, 34, 43, 26, 39};
dates = {1543, 1600, 1665, 1746, 1774, 1839, 1858, 1864, 1896, 1901,
1905, 1926};
data = Transpose[{dates, ages}];
model = LinearModelFit[data, t, t]
residuals = model["FitResiduals"]
KolmogorovSmirnovTest[residuals]
KolmogorovSmirnovTest[residuals, NormalDistribution[],
"HypothesisTestData"]["TestDataTable"]
@codyhan94
codyhan94 / gist:7b9f00691c855520f51d
Created November 8, 2014 20:42
PQ comparable fix
from queue import PriorityQueue
import config
class EventQueue:
def __init__(self):
self.q = PriorityQueue()
def get(self):
if self.q.empty():
return -1
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'