Skip to content

Instantly share code, notes, and snippets.

View andreis's full-sized avatar

andreis

View GitHub Profile
@andreis
andreis / <OperatorsOperatingOperations@spamgoes.in>
Last active January 4, 2016 14:59
Best spam I've ever received
If you are suffering PTSD and feeling suicidal, because of what you did whilst serving in foreign fields, and feel you cannot live with yourself and what you did any longer, then you are ready to redeem yourself with God.
Committing suicide is not The Way and is against God's Law, for which you will find no rest, only punishment from God.
The only way to redeem yourself is to start to keep the First and Great Commandment - "And thou shalt love the Lord thy God with all thy heart, and with all thy soul, and with all thy mind, and with all thy strength and serve Him ONLY: this is the first Commandment" - the one you should never have broken, and which, if you had kept it, would have prevented you from being in the tragic position you are in today.
911 was an inside job. You went to war for a lie, told to you by the people you swore to defend your country against - domestic enemies/traitors. The ones who did this to you are not 5 thousand miles away and you know their names and where to find them. (See "Iraq
@andreis
andreis / my-etc-hosts
Created February 8, 2014 16:48
My /etc/hosts for Getting Shit Done
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
#!/usr/bin/env python3
# https://www.hackerrank.com/challenges/insertion-sort
'''
0 1 2 3 .. n-1
n = 6
3 1 2 5 1 2 array
4 0 1 2 0 0 DP array
#!/usr/bin/env python3
# https://www.hackerrank.com/challenges/insertion-sort
count = 0
def mergesort(L, l, r):
if l+1 >= r: return
mid = int((l+r+1)//2)
mergesort(L, l, mid)
#!/usr/bin/env python3
# https://www.hackerrank.com/challenges/angry-children
import sys
def solve(L, k):
# stuff
n = int(input())
k = int(input())
Usage: new [options] args
Options:
-h --help
display this message
-i --install
install templates from a repository
-s --silent -f --force
supress output; silent fail, all answers Yes
-t --template
Consider using 'dppx' units instead of 'dpi', as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5)
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
WebGL: INVALID_OPERATION: drawArrays: attribs not setup correctly dir/Interlaken,+Switzerland/Zurich,+Switzerland/@47.240032,8.616212,11z/dat…1m1!1s0x47900b9749bea219:0xe66e8df1e71fdc03!2m2!1d8.5391825!2d47.3686498:1
WebGL: INVALID_VALUE: texImage2D: width or height out of range dir/47.2308094,8.6342368/Nice,+France/@45.5564777,6.0122439,7z/data=!3m1!4b…m1!1s0x12cdd0106a852d31:0x40819a5fd979a70!2m2!1d7.265592!2d43.696036!3e0:1
254
WebGL: INVALID_VALUE: texSubImage2D: dimensions out of range dir/47.2308094,8.6342368/Nice,+France/@45.5564777,6.0122439,7z/data=!3m1!4b…m1!1s0x12cdd0106a852d31:0x40819a5fd979a70!2m2!1d7.265592!2d43.696036!3e0:1
WebGL: too many errors, n
func Tokenize(s string) []string {
out := []string{}
for l, r := 0, 0; r < len(s); {
for l = r; isSep(s[l]); l++ {
}
for r = l; r < len(s) && !isSep(s[r]); r++ {
}
out = append(out, s[l:r])
}
return out
@andreis
andreis / tree-ser-deser.go
Last active August 29, 2015 13:57
A somewhat obvious solution is to emulate a heap and replace the missing nodes with "x" markers, but this performs badly on path trees (only left links). An improvement would be to replace consecutive "x"-es by "x<number>", where number==how many x-es are replaced. The solution in this gist does a depth-first traversal and prints the tree recurs…
package main
import (
"fmt"
"math/rand"
"strconv"
"strings"
"time"
)
Process: Google Music [13389]
Path: /opt/homebrew-cask/*/Google Music.app/Contents/MacOS/Google Music
Identifier: com.sajidanwar.Google-Music
Version: 1.1.1 (0)
Code Type: X86-64 (Native)
Parent Process: launchd [241]
Responsible: Google Music [13389]
User ID: 501
Date/Time: 2014-03-26 14:38:26.746 +0000