Skip to content

Instantly share code, notes, and snippets.

View rancheng's full-sized avatar
Working from home

Ran Cheng rancheng

Working from home
View GitHub Profile
zrsmithson / mngw-w64_boost.MD
Last active April 23, 2024 04:55
Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Installing boost on Windows using MinGW-w64 (gcc 64-bit)


Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.

Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow

Get files needed for install

Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the source from Sourceforge
__Note: This should work perfectly w

Cr4sh / DmaHvBackdoor.c
Last active January 23, 2024 22:31
Hyper-V backdoor for UEFI
Part of UEFI DXE driver code that injects Hyper-V VM exit handler
backdoor into the Device Guard enabled Windows 10 Enterprise.
Execution starts from new_ExitBootServices() -- a hook handler
for EFI_BOOT_SERVICES.ExitBootServices() which being called by
winload!OslFwpKernelSetupPhase1(). After DXE phase exit winload.efi
transfers exeution to previously loaded Hyper-V kernel (hvix64.sys)
michaelosthege /
Last active February 28, 2024 22:16
Convert MP4/AVI clips to GIF with a single Python function
import imageio
import os, sys
class TargetFormat(object):
GIF = ".gif"
MP4 = ".mp4"
AVI = ".avi"
def convertFile(inputpath, targetFormat):
gelim /
Last active August 10, 2022 13:57
sharelatex (non-docker) installation on a ubuntu 16.04 server

Installing ShareLaTex on Ubuntu 16.04

Use this as-is without any warranty, and don't bug ShareLatex project members if there are problems with my instructions. They officialy support docker installation only.

This gist summarize the actions I did to setup a pure ShareLaTex community edition on a bare linux ubuntu 16.04 server (no docker). I intentionnaly tried to stick to distribution practice for running daemons (via runit, and not via a custom my_init + setuser wrapper).

I basically took ShareLaTeX receipt to build their docker and adapted it.

Vestride /
Last active June 5, 2024 14:38
Encoding video for the web

Encoding Video


Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
RustingSword /
Created September 7, 2014 12:33
least square plane fitting of 3d points
import numpy as np
import scipy.optimize
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
def fitPlaneLTSQ(XYZ):