Skip to content

Instantly share code, notes, and snippets.

View jim3ma's full-sized avatar
🎯
Focusing

Jim Ma jim3ma

🎯
Focusing
View GitHub Profile
@jim3ma
jim3ma / ova-gen.sh
Created March 3, 2016 04:36 — forked from rubiojr/ova-gen.sh
Convert VMDK to OVA using VirtualBox
#!/bin/sh
#
# http://jbrazile.blogspot.com.es/2012/01/scripted-vmdkova-images-wboxgrinder-and.html
#
NAME=$1
OS=$2
IMAGE=
SZMB=384
INSTDIR=/tmp/ova-gen/boxes
BUILDDIR=/tmp/ova-gen/builds
@jim3ma
jim3ma / ngrok-selfhosting-setup.md
Created March 16, 2016 01:29 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@jim3ma
jim3ma / mptcp_rpm_install.md
Created March 22, 2016 14:32 — forked from nak3/mptcp_rpm_install.md
mptcp kernel RPM package install instructions

Description

mptcp_kernel is the kernel package which built with mptcp (MultiPath TCP) function. The source code is hosted in github .

The RPM package is hosted on Fedora copr. It can be used on Fedora and CentOS (only x86_64) and their some versions..

####WARNING

This package is now still working in progress and being tested by Kenjiro Nakayama. Please don't use it in your production system. And this is not official repository and please take full responsibility for your actions.

@jim3ma
jim3ma / proxy.go
Created March 23, 2016 06:28 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@jim3ma
jim3ma / golang-tls.md
Created June 15, 2016 00:49 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@jim3ma
jim3ma / background.sh
Created March 14, 2017 07:15 — forked from zaius/background.sh
How to redirect a running process output to a file and log out
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)
@jim3ma
jim3ma / trial.key
Created August 28, 2017 08:56 — forked from huqi/trial.key
Beyond Compare 4 license for Mac
Beyond Compare 4
Licensed to: ASIO Allsoftinone
Quantity: 1 user
Serial number: 1822-9597
License type: Pro Edition for Windows
--- BEGIN LICENSE KEY ---
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t
# coding: utf-8
# 更新于2017/10/02,python3测试通过
import re
import requests
# 领取 X 铜币
# 每日登录奖励已领取
base_headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.57 Safari/537.36 OPR/40.0.2308.15 (Edition beta)', 'Referer': 'https://www.v2ex.com/signin', 'Origin': 'https://www.v2ex.com'}
@jim3ma
jim3ma / blog-webpack-2.md
Created January 16, 2018 12:35 — forked from xjamundx/blog-webpack-2.md
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@jim3ma
jim3ma / recvfd.c
Last active August 21, 2018 06:26 — forked from kokjo/sendfd.c
Send a file descriptor over an abstract unix domain socket
// compile with: gcc -static -o recvfd recvfd.c
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <strings.h>
/**
* Receives file descriptor using given socket
*
* @param socket to be used for fd recepion