Skip to content

Instantly share code, notes, and snippets.

View komuw's full-sized avatar

Komu Wairagu komuw

View GitHub Profile
@komuw
komuw / lambda.py
Created September 26, 2018 16:03
lambda shim
import subprocess
import json
proc = subprocess.Popen(['./main'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
universal_newlines=True,
bufsize=1)
def id_generator():
@komuw
komuw / goproxy.py
Last active April 9, 2022 20:31
Go module proxy implemented in python/django
import json
from django.http import HttpResponse
class Modules(APIView):
"""
For documentation, see; https://github.com/golang/go/blob/master/src/cmd/go/internal/modfetch/proxy.go
call this like;
sudo rm -rf ~/go/src/mod/ && \
export GOPROXY=http://localhost:4000 && \
@komuw
komuw / Golang_PR.md
Last active October 18, 2018 11:20
create PR to a golang project
@komuw
komuw / compression.py
Created June 27, 2018 07:26
different compression sizes
# pre-requistes:
# pip install brotli ; from https://github.com/google/brotli/tree/master/python
# pip install zstandard ; from https://github.com/indygreg/python-zstandard
# pip install python-lzo ; from https://github.com/jd-boyd/python-lzo
# zlib is in the python stdlib
import json
import zlib
import brotli
import zstandard
@komuw
komuw / 01_flutter.md
Last active September 2, 2019 13:06
flutter notes

flutter

@komuw
komuw / gctest.go
Last active January 25, 2018 14:26
measure GC for different maps
package main
import (
"strconv"
"fmt"
"os"
"runtime"
"time"
)
// run this program as:
/*
@komuw
komuw / extractnums.py
Created August 28, 2017 12:52
extract numbers from string
str = "h3110 23 cat 444.4 rabbit 11 2 dog"
numbers = [int(s) for s in str.split() if s.isdigit()]
sum_of_numbers = sum(numbers)
print "sum_of_numbers:", sum_of_numbers
@komuw
komuw / grub
Created July 26, 2017 09:12
edit grub, debug boot errors, hibernate errors etc
1. cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true