Skip to content

Instantly share code, notes, and snippets.

View selfboot's full-sized avatar
🎯
Focusing

selfboot selfboot

🎯
Focusing
View GitHub Profile
!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
selfboot / OpenSSLExample.cpp
Created December 25, 2018 09:21 — forked from irbull/OpenSSLExample.cpp
Code signing and verification with OpenSSL
#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>
// 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
selfboot / Nginx-centos.md
Created September 25, 2017 08:19
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
selfboot / nginxproxy.md
Created September 11, 2017 06:29 — forked from soheilhy/nginxproxy.md
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 example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

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

@selfboot
selfboot / .tmux.conf
Created July 31, 2017 04:28
My tmux conf file.
# enable scrolling into tmux panels with mouse wheel.
# https://stackoverflow.com/questions/7798103/how-to-enable-scrolling-in-tmux-panels-with-mouse-wheel
set -g mouse on
@selfboot
selfboot / tcpdump.md
Last active May 29, 2017 09:09
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.

Install

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
@selfboot
selfboot / commands.md
Last active May 29, 2017 03:14
Linux commands often used.

Kernel Version

If you want kernel version information, use uname(1). For example:

$ uname -a
Linux cheapss 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Distribution Version

@selfboot
selfboot / tmux.conf
Last active March 29, 2017 07:22 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@selfboot
selfboot / sendMail.py
Created March 21, 2017 11:34
Python 简单发送邮件
#! /usr/local/bin/python
SMTPserver = 'smtp.sina.com'
sender = '<[email protected]>'
destination = ['[email protected]']
USERNAME = "[email protected]"
PASSWORD = "*******"
# typical values for text_subtype are plain, html, xml