Skip to content

Instantly share code, notes, and snippets.

Avatar

Sarkis Nanyan spellanser

View GitHub Profile
@bgadrian
bgadrian / set.go
Last active Feb 19, 2021
How to implement a simple set data structure in golang
View set.go
type Set struct {
list map[int]struct{} //empty structs occupy 0 memory
}
func (s *Set) Has(v int) bool {
_, ok := s.list[v]
return ok
}
@moloch--
moloch-- / Makefile
Last active Jul 25, 2021
Basic cross-platform reverse shell in Go
View Makefile
EXE = shell
SRC = .
LDFLAGS = -ldflags="-s -w"
windows:
GOOS=windows go build -o $(EXE)_win.exe $(LDFLAGS) $(SRC)
macos:
GOOS=darwin go build -o $(EXE)_macos $(LDFLAGS) $(SRC)
@rindeal
rindeal / interrupts_stats.sh
Last active Jul 26, 2018
Pretty print /proc/interrupts
View interrupts_stats.sh
#!/bin/sh
sed -r -e 's/^ *//' -e 's/ {2,}/|/g' < /proc/interrupts | \
awk -F'|' '
BEGIN { cpu_n = 0; }
NR == 1 {
for(i = 1; i <= NF; i++)
if($i ~ CPU)
cpu_n++;
}
View gist:7099390
fin = open("input.xml", "r")
a = fin.readline()
l = ""
kk = False
while len(a)!=0:
a = fin.readline()
if a.find("<kernel>")!=-1 and kk==False:
p = a.find("<kernel>")
for i in range(0,p):
l+= " "
@jboner
jboner / latency.txt
Last active Jul 29, 2021
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@spellanser
spellanser / gist:2426450
Created Apr 20, 2012
laba 5 finish Assembly
View gist:2426450
; Template for console application
.586
.MODEL flat , c
OPTION CASEMAP:NONE
.CONST
MsgExit DB 13,10,"Press Enter to Exit",0AH,0DH,0
;Задание
;Вариант 11.