Skip to content

Instantly share code, notes, and snippets.


selfboot selfboot

View GitHub Profile
selfboot / waiter.h
Created Oct 11, 2019 — forked from chenshuo/waiter.h
A handful of implementations of Waiter class for discussion.
View waiter.h
#include <boost/noncopyable.hpp>
#include <pthread.h>
#include <stdlib.h>
// a superfluous check for pedantic people
inline void CHECK_SUCCESS(int ret)
if (ret != 0)
View test_backtrace.cpp
* traceback for cpp
* Created on: 2018-01-27
* Author: owent
* Released under the MIT license
* @note Required flag -rdynamic or addr2line to get the function name when using gcc/clang in unix like system
* @note Using addr2line -Cfpe <exe_path> [func_addr...] for more detail when using gcc/clang
selfboot /
Last active Apr 29, 2019

You can use os.path.expanduser to convert ~ into your home directory:

>>> import os
>>> os.path.expanduser('~/.config.txt')

This works on both *nix and Windows systems.

View rsa.js
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var i=r();for(var e in i)("object"==typeof exports?exports:t)[e]=i[e]}}(window,function(){return function(t){var r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=r,i.d=function(t,r,e){i.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,r){if(1&r&&(t=i(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)i.d(e,n,function(r){return t[r]}.bind(null,n));return e},i.n=function(t){var r=t&&t.__esModule?function(){return
selfboot / OpenSSLExample.cpp
Created Dec 25, 2018 — forked from irbull/OpenSSLExample.cpp
Code signing and verification with OpenSSL
View OpenSSLExample.cpp
#include <iostream>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <assert.h>
View rsa.js
// Random number generator - requires a PRNG backend, e.g. prng4.js
// For best results, put code like
// <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
// in your main HTML document.
var rng_state;
var rng_pool;
var rng_pptr;
selfboot /
Created Sep 25, 2017
Centos Install Nginx

centopia | the nginx build guide

This is a step-by-step guide on how to build Nginx-1.6.2 from source on a CentOS 7 VPS or Virtualbox.

Manual Build

update yum to use current & stable CentOs libraries

$ yum -y update
selfboot /
Created Sep 11, 2017 — forked from soheilhy/
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

selfboot / .tmux.conf
Created Jul 31, 2017
My tmux conf file.
View .tmux.conf
# enable scrolling into tmux panels with mouse wheel.
set -g mouse on
selfboot /
Last active May 29, 2017
Quick doc about how to use tcpdump.

Tcpdump is a network packet analyzer that runs under the command line. It is used to create "dumps" or "traces" of network traffic. It allows you to look at what is happening on the network and really can be useful for troubleshooting many types of issues including issues that aren't due to network communications. Outside of network issues I use tcpdump to troubleshoot application issues all the time; if you ever have two applications that don't seem to be working well together, tcpdump is a great way to see what is happening. This is especially true if the traffic is not encrypted as tcpdump can be used to capture and read packet data as well.


Since tcpdump is not included with most base systems, you will need to install it. However, nearly all Linux distributions have tcpdump in their core repositories. For Debian based distributions, the command to install tcpdump is:

apt-get install tcpdump