Skip to content

Instantly share code, notes, and snippets.

@yekm
yekm / coubackup.sh
Created Mar 17, 2022
backup best videos from coub
View coubackup.sh
set -vx
# docker run -v /mnt/archive:/mnt --rm -it --entrypoint bash node
# apt install jq ffmpeg
# npm i -g coub-dl
# 2021 : 58
#url="https://coub.com/api/v2/best/58/coubs?type=coubs&"
# 2020 : 52
#url="https://coub.com/api/v2/best/52/coubs?type=coubs&"
View Keybase.md

Keybase proof

I hereby claim:

  • I am yekm on github.
  • I am yekm (https://keybase.io/yekm) on keybase.
  • I have a public key ASApjbVqb8ndqpXIozCQk0IeHH7q-1su8lBSrhk_dRfWdAo

To claim this, I am signing this object:

@yekm
yekm / extract_rombank.c
Created Jul 8, 2019
extracting rom files from rombank.bin from imbnes psx iso image
View extract_rombank.c
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@yekm
yekm / sourcegrep.sh
Created Sep 12, 2018
dumb bash preprocessor
View sourcegrep.sh
#!/bin/bash -evx
#replace strings like !sg{int peer_id net/receivethread.cpp} to relevant source:line string like net/receivethread.cpp:123
grep -P -o '!sg\{[^\n]+?\}' $1 | sed -e 's/}$//' -e 's/!sg{//' | while read l
do
file=$(echo "$l" | rev | cut -f 1 -d' ' | rev)
pattern=$(echo "$l" | sed -e "s; $file$;;")
pointer=$(grep -FnH "$pattern" $file | cut -f 1-2 -d: | head -n1)
echo "$file $pattern $pointer"
@yekm
yekm / test.log
Created May 14, 2018
simde tests
View test.log
Running test suite with seed 0x46796a6b...
/x86/mmx/mm_set_pi8 [ OK ] [ 0.00003633 / 0.00003433 CPU ]
/x86/mmx/mm_set_pi16 [ OK ] [ 0.00003500 / 0.00003367 CPU ]
/x86/mmx/mm_set_pi32 [ OK ] [ 0.00003367 / 0.00003233 CPU ]
/x86/mmx/mm_set1_pi8 [ OK ] [ 0.00004333 / 0.00004167 CPU ]
/x86/mmx/mm_set1_pi16 [ OK ] [ 0.00003433 / 0.00003367 CPU ]
/x86/mmx/mm_set1_pi32 [ OK ] [ 0.00003233 / 0.00003167 CPU ]
/x86/mmx/mm_setr_pi8 [ OK ] [ 0.00003500 / 0.00003333 CPU ]
/x86/mmx/mm_setr_pi16 [ OK ] [ 0.00003367 / 0.00003300 CPU ]
/x86/mmx/mm_setr_pi32 [ OK ] [ 0.00003300 / 0.00003167 CPU ]
@yekm
yekm / comments
Last active Feb 9, 2018
various snippents
View comments
# extract lines with c-style comments
sed -ne '/\/\*/ bp; /\/\// p; b; :p; p; /\*\// b; n; bp;'
@yekm
yekm / adblock.sh
Created Aug 31, 2015
hostname based adblock
View adblock.sh
# add addn-hosts=/tmp/adblocker_hostlist to dnsmasq config
HOST_LISTS="
http://adaway.org/hosts.txt
http://www.malwaredomainlist.com/hostslist/hosts.txt
http://www.mvps.org/winhelp2002/hosts.txt
http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate%5Bday%5D=&startdate%5Bmonth%5D=&star
"
wget -O- $HOST_LISTS | sed -rn 's/^(127.0.0.1|0.0.0.0)/0.0.0.0/p' | awk '{ print $1,$2 }' | sort -uk2 | sed -r 's/([^ ]+)$/\1\n:: \1/' >/tmp/adblocker_hostlist
killall -HUP dnsmasq
View findsubimage.py
import cv2, sys
import numpy
image = cv2.imread(sys.argv[1])
image = image[318:812,468:1156,:]
template = cv2.imread(sys.argv[2])
#template = image[30:40,30:40,:]
#cv2.imshow('image', image)
@yekm
yekm / aol
Last active May 18, 2016
styles
View aol
#reader-ad-container {
display: none !important;
}
#reader-container {
margin-right: 0 !important;
// margin-top: 0 !important;
}
.article-wrap {