Skip to content

Instantly share code, notes, and snippets.

View ulinkwo's full-sized avatar
🤒
Out sick

Kyle Liu ulinkwo

🤒
Out sick
View GitHub Profile
@ulinkwo
ulinkwo / convert.js
Created February 26, 2022 04:17 — forked from miracle2k/convert.js
Convert Ethereum private keys to EOS private keys (the "Fallback method" to access your EOS tokens).
// Extracted from https://github.com/eoscafe/eoskeyio
const ecc = require('eosjs-ecc');
const eth = require('ethereumjs-util');
let ethereumPrivateKey = 'FILL THIS IN';
if(eth.isValidPrivate(Buffer.from(ethereumPrivateKey, 'hex'))) {
let ethereumAddress = '0x' + eth.privateToAddress(Buffer.from(ethereumPrivateKey, 'hex')).toString('hex')
let ethereumPublicKey = eth.privateToPublic(Buffer.from(ethereumPrivateKey, 'hex')).toString('hex')
@ulinkwo
ulinkwo / gpg-ssh-setup.md
Last active September 22, 2021 03:47 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@ulinkwo
ulinkwo / GPG and git on macOS.md
Created July 13, 2018 07:35 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@ulinkwo
ulinkwo / GPG Capabilities.md
Last active August 21, 2018 02:23 — forked from mkroman/GPG Capabilities.md
GPG key capabilities and usage meanings

Signing is signing data (i.e. gpg --sign the_file)

Certification is signing a key (i.e. gpg --sign-key the_key)

Authentication is signing a challenge (like ssh does). The Authentication stuff can be used to log in to a machine using your GPG key.

The signature math is the same however you do it. The key usage flags are just to classify things.

@ulinkwo
ulinkwo / iterm.md
Created August 30, 2016 10:17 — forked from suziewong/iterm.md
iterm2 tmux

多窗口管理 我们可以使用多窗口,也可以使用多标签来操作。

分割当前的窗口可以使用:

cmd + d 水平分割窗口

cmd + shift + d 垂直分割窗口

cmd + [ 和 cmd + ]在分割窗口之间切换

@ulinkwo
ulinkwo / ssh.md
Last active September 10, 2021 09:15 — forked from suziewong/ssh.md
SSH端口转发实验

通过本机的81号端口访问测试服务器89的我的私人apache目录(端口为11063)

使用本地转发,在本机上输入

ssh -L 81:210.32.200.89:11063 suzie@210.32.200.89

这时候打开浏览器,输入地址127.0.0.1:81 我同时也试验了

ssh -L 81:127.0.0.1:11063 suzie@210.32.200.89

ssh -L 81:localhost:11063 suzie@210.32.200.89

@ulinkwo
ulinkwo / build_nginx.sh
Created August 13, 2016 12:26 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL (and http2)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.11.3
export VERSION_PCRE=pcre-8.38
export VERSION_LIBRESSL=libressl-2.4.2
export VERSION_NGINX=nginx-$NGINX_VERSION
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
/**
* Extension class between spring data commons and java.util.List that is
* required to get MyBatis to use it as a return value.
@ulinkwo
ulinkwo / tomcat.pp
Created December 2, 2013 14:20 — forked from ehazlett/tomcat.pp
class tomcat {
$tomcat_url = "http://mirrors.axint.net/apache/tomcat/tomcat-7/v7.0.25/bin/apache-tomcat-7.0.25.tar.gz"
$jdk_url = "http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin"
Exec {
path => "${::path}",
}
group { "puppet":
ensure => present,
}

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs