Skip to content

Instantly share code, notes, and snippets.

View nebgnahz's full-sized avatar

Ben Zhang nebgnahz

View GitHub Profile
@nebgnahz
nebgnahz / scheme-full.txt
Created May 6, 2018 21:50
tlmgr scheme-full all packages
[1/3524, ??:??/??:??] install: 12many [3k]
[2/3524, 00:00/00:00] install: 2up [5k]
[3/3524, 00:00/00:00] install: Asana-Math [481k]
[4/3524, 00:01/31:34] install: ESIEEcv [2k]
[5/3524, 00:01/31:28] install: FAQ-en [1k]
[6/3524, 00:02/01:02:52] install: GS1 [4k]
[7/3524, 00:02/01:02:27] install: HA-prosper [28k]
[8/3524, 00:02/59:06] install: IEEEconf [3k]
[9/3524, 00:02/58:50] install: IEEEtran [88k]
[10/3524, 00:03/01:15:36] install: MemoirChapStyles [1k]
@nebgnahz
nebgnahz / shaper
Last active June 21, 2024 19:45
Traffic Shape using `tc` for Linux
#!/bin/bash
set -e
function usage() {
cat << EOF
USAGE:
./shaper start <interface> <bw as XXX kbit>
./shaper clear <interface>
./shaper show <interface>
EOF
@nebgnahz
nebgnahz / MacOS.md
Created December 6, 2016 07:24
Network Tools

netcat

Use GNU netcat 0.7.1 from Homebrew.

# listener
netcat -l -p 4444

# sender
netcat localhost 4444
@nebgnahz
nebgnahz / http_varz.rs
Created October 20, 2016 07:25
A proof-of-concept varz interface that takes GET/PUT HTTP request and changes the internal value
extern crate iron;
use std::collections::HashMap;
use std::str::FromStr;
use std::io::Read;
use std::sync::RwLock;
use iron::prelude::*;
use iron::{status, Handler};
@nebgnahz
nebgnahz / README.md
Last active August 31, 2016 20:05
Deploy gh-pages

See deploy.sh.

Typical usage:

GIT_DEPLOY_DIR=<dir> GIT_DEPLOY_BRANCH=gh-pages deploy.sh -v

For ESP, I am using the following command:

@nebgnahz
nebgnahz / README.md
Created August 31, 2016 17:43
OpenCV __cg_jpeg_resync_to_restart
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
error: Process didn't exit successfully: `target/debug/main` (signal: 5, SIGTRAP: trace/breakpoint trap)

Similarly for libTIFF.dylib, etc.

@nebgnahz
nebgnahz / sd-dedup.sh
Created August 8, 2016 05:41
Clean up SDCard. I normally scan my photos with JPG because it's much faster to load. And I will make changes, delete bad ones, during the scan. In the end, I want the corresponding CR2 whose JPG counterparts have been removed being cleaned. This script does the job.
#!/bin/sh
set -e
cd /Volumes/CANON/DCIM/100CANON;
for f in *.CR2
do
b=$(basename $f .CR2)
if [ ! -f "/Volumes/CANON/DCIM/100CANON/$b.JPG" ]; then
rm $b.CR2
fi
@nebgnahz
nebgnahz / cblas-test.cpp
Created August 6, 2016 22:26
Use BLAS for matrix multiplication
#include <stdio.h>
#if __APPLE__
#include <Accelerate/Accelerate.h>
#elif __linux__
#include <cblas.h>
#endif
// Calculate a * b
float a[4][4] = {
@nebgnahz
nebgnahz / Images-Photos.md
Created August 4, 2016 23:45
Useful mac utilities for everyday tasks

Use sips to convert images from types to types and to the same resolution:

for i in *.tiff; do sips -z 600 600 -s format png $i --out converted/$i.png; done
@nebgnahz
nebgnahz / CMakeLists.txt
Created July 26, 2016 22:40
Simple CMakeLists of using IMGUI on Mac OS (with GLFW)
cmake_minimum_required(VERSION 3.0.0)
set(PROJECT project-name)
project(${PROJECT})
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_demo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_draw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_impl_glfw.cpp