Skip to content

Instantly share code, notes, and snippets.

View koolay's full-sized avatar
🏠
Working from home

koolay koolay

🏠
Working from home
  • Mars
View GitHub Profile
@koolay
koolay / prepull.yaml
Created September 21, 2022 17:21 — forked from itaysk/prepull.yaml
Kubernetes: Pre-pull images into node (moved to: https://github.com/itaysk/kube-imagepuller )
###
# There's a newer version available here:
# https://github.com/itaysk/kube-imagepuller
# All future updates will be made there.
# Please also post you questions as issues on that repo instead of commenting here
###
apiVersion: apps/v1beta2
kind: DaemonSet
@koolay
koolay / gunicorn.conf.py
Created July 31, 2020 15:06
profling gunicorn app
# pip3 install pyinstrument
import os
from pyinstrument import Profiler
PROFILER = bool(int(os.environ.get("PROFILING", 1)))
# from pyinstrument.renderers import JSONRenderer
def pre_request(worker, req):
if PROFILER:
@koolay
koolay / arrow_flight_dremio.py
Created July 28, 2020 04:01
demo of arrow-flight+dremio+vaex
from collections import namedtuple
import vaex
import time
import orjson
import os
import psutil
from pyarrow import flight
import pyarrow as pa
@koolay
koolay / install_fira_code_foint.sh
Created March 9, 2020 03:53
install JetbrainsMono fonts with nerd-foints patch
cd ~/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/JetBrainsMono/Medium/complete/JetBrains%20Mono%20Medium%20Nerd%20Font%20Complete.ttf
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/JetBrainsMono/Bold/complete/JetBrains%20Mono%20Bold%20Nerd%20Font%20Complete.ttf
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/JetBrainsMono/Italic/complete/JetBrains%20Mono%20Italic%20Nerd%20Font%20Complete.ttf
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/JetBrainsMono/Regular/complete/JetBrains%20Mono%20Regular%20Nerd%20Font%20Complete.ttf
sudo fc-cache -fv
@koolay
koolay / deepin-wxwork.md
Last active January 10, 2020 11:22
解决ubuntu下企业微信乱码问题

解决乱码+修改字体(微软雅黑)

下载微软雅黑字体, msyh.ttc

1.添加字体 cp msyh.ttc ~/.deepinwine/Deepin-WXWork/drive_c/windows/Fonts/

2.修改系统注册表

gedit ~/.deepinwine/Deepin-WXWork/system.reg

@koolay
koolay / install_fira_code_foint.sh
Last active December 21, 2019 10:10
install firaCode fonts
export http_proxy=127.0.0.1:8123
export https_proxy=127.0.0.1:8123
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/FiraCode/Bold/complete/Fira%20Code%20Bold%20Nerd%20Font%20Complete.otf
wget https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/FiraCode/Light/complete/Fira%20Code%20Light%20Nerd%20Font%20Complete.otf
@koolay
koolay / cocurrency_request.go
Created March 20, 2019 18:43
cocurrency http client example for golang
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"sync"
"sync/atomic"
"time"
@koolay
koolay / prom.proxy.go
Created February 26, 2019 12:29
simple proxy for prometheus
package main
import (
"compress/gzip"
"context"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
@koolay
koolay / rsa.py
Last active July 3, 2020 14:56
rsa.python
import base64
import io
from Crypto import Random
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP as PKCS1_OAEP_Cipher
def gen_key_pair(passpharse=None):
"""
@koolay
koolay / extractGifs.py
Created May 24, 2017 11:19 — forked from revolunet/extractGifs.py
extract frames from animated gif using python+PIL
import os
from PIL import Image
def extractFrames(inGif, outFolder):
frame = Image.open(inGif)
nframes = 0
while frame:
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF')
nframes += 1