Skip to content

Instantly share code, notes, and snippets.

@non-static
non-static / format_json.ps1
Created March 6, 2023 18:40
How to format json file with PowerShell? #I-hate-powershell#
Get-Content jsonfile.json | ConvertFrom-Json | ConvertTo-Json -Depth 100 | Set-Content -Path newfile.json
@non-static
non-static / .tmux.conf
Last active January 1, 2023 02:12
oh-my-zsh + tmux + auto start tmux
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
@non-static
non-static / cheatsheet.md
Last active December 11, 2022 06:18
Shortcuts Cheat Sheet

Shortcuts Cheat Sheet

Tmux

Shortcuts start with Ctrl+b

Basic concepts

  • Pane: sub-window on the current "screen"
  • Window: different "screen"
@non-static
non-static / init.vim
Created November 24, 2022 06:59
NeoVim setup
" Precondition
" * python3 -m pip install pynvim
" * Install latest nodejs
set nocompatible " disable compatibility to old-time vi
set showmatch " show matching
set ignorecase " case insensitive
set mouse=v " middle-click paste with
set hlsearch " highlight search
set incsearch " incremental search
@non-static
non-static / download_hf.py
Created March 14, 2022 04:51
Given a HuggingFace model card link like this: "https://huggingface.co/bert-base-uncased/tree/main", download all files in the list, using python asyncio.
import os
import sys
import requests
import asyncio
import aiohttp
import aiofile
from bs4 import BeautifulSoup
HOST = "https://huggingface.co"
#!/bin/bash
printf "%-10s%-15s%-15s%s\n" "PID" "OWNER" "MEMORY" "COMMAND"
function sysmon_main() {
RAWIN=$(ps -o pid,user,%mem,command ax | grep -v PID | awk '/[0-9]*/{print $1 ":" $2 ":" $4}')
for i in $RAWIN
do
PID=$(echo $i | cut -d: -f1)
@non-static
non-static / .vimrc
Last active July 31, 2022 23:53
VIM setup
" Plug-ins
" ==========
" * https://github.com/preservim/nerdtree
" * https://github.com/vim-airline/vim-airline
" -----------------------------------------------
" Powerline font for https://github.com/vim-airline/vim-airline
let g:airline_powerline_fonts = 1
@non-static
non-static / header_value_analysis.lua
Created April 29, 2020 20:58
Analysis header values with percentiles
wrk.method = "POST"
local f = io.open("batch_4.json", "r")
wrk.body = f:read("*all")
wrk.headers["Content-Type"] = "application/json"
wrk.headers["Authorization"] = "Bearer <token>"
local threads = {}
function percentile(data, p)
local sortedData = { }
@non-static
non-static / upload_by_curl.sh
Created April 16, 2020 04:16
Upload a file to Azure Blob Storage by curl
#!/bin/bash
curl -X PUT -T ./gpu_tests.tgz -H "x-ms-date: $(date -u)" -H "x-ms-blob-type: BlockBlob" "https://bohudata.blob.core.windows.net/temp/gpu_tests.tgz?<sas_token_to_folder>"
@non-static
non-static / split_symbole_binary.sh
Created February 25, 2020 07:33
Split binary and symbol for release build
objcopy --only-keep-debug "${tostripfile}" "${debugdir}/${debugfile}"
strip --strip-debug --strip-unneeded "${tostripfile}"
objcopy --add-gnu-debuglink="${debugdir}/${debugfile}" "${tostripfile}"