Skip to content

Instantly share code, notes, and snippets.

View blukat29's full-sized avatar

Yunjong Jeong (ollie) blukat29

View GitHub Profile
#!/bin/bash
set -e
org=klaytn
since=2023-01-01
until=2023-12-31
# This public API only shows public repos. type=source excludes forks.
curl -sSL "https://api.github.com/orgs/$org/repos?type=source&per_page=100&page=1" -o repos.json
#ifndef _DEFER_H
#define _DEFER_H
/**
* @file defer.h
* @brief Golang-like defer in standard C++11.
*
* Original idea from https://stackoverflow.com/a/42060129/8939955.
*/
#!/bin/sh
# IMPORTANT!
# Dont work in Linux 4.8.0
# Works in Linux 4.4.0
# http://halobates.de/blog/p/410
sudo sh -c "echo 'kernel.kptr_restrict=0' >> /etc/sysctl.conf"
# https://superuser.com/questions/980632/run-perf-without-root-rights
sudo sh -c "echo 'kernel.perf_event_paranoid=1' >> /etc/sysctl.conf"
#!/bin/sh
set -ex
# Dependencies
sudo apt-get install -y wget unzip xz-utils build-essential openssl bc curl libssl-dev
# Install SDKs
sudo apt-get install -y ocl-icd-libopencl1 ocl-icd-opencl-dev
import requests
import sys
import re
import urllib
def sizeof_fmt(num, suffix='B'):
for unit in ['','K','M','G']:
if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix)
num /= 1024.0
def bsearch(a, compare, match=None):
"""
Binary search under limited comarison capability
when match == None:
compare(y) returns
y > key => positive int
y = key => 0
y < key => negative int
when match != None;