Skip to content

Instantly share code, notes, and snippets.

View changsijay's full-sized avatar
🐧
I may be slow to respond.

Jay Chang changsijay

🐧
I may be slow to respond.
  • Taiwan
View GitHub Profile
@changsijay
changsijay / server.py
Created March 18, 2018 11:48 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@changsijay
changsijay / SimpleAuthServer.py
Created March 18, 2018 11:49 — forked from fxsjy/SimpleAuthServer.py
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@changsijay
changsijay / http_get.go
Created April 4, 2018 03:37 — forked from hidva/http_get.go
golang wget
package main
import (
"context"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
@changsijay
changsijay / secret-key-gen.py
Created April 4, 2018 09:09 — forked from ndarville/secret-key-gen.py
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@changsijay
changsijay / tmux-cheatsheet.markdown
Created July 24, 2018 05:04 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@changsijay
changsijay / GitCommitEmoji.md
Created November 27, 2018 07:55 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@changsijay
changsijay / boostnote2md.py
Created February 14, 2019 11:36 — forked from weaming/boostnote2md.py
Convert boostnote cson format data to markdown
#!/usr/bin/env python3
# coding: utf-8
"""
Author : weaming
Created Time : 2018-05-26 21:32:59
Prerequisite:
python3 -m pip install cson arrow
"""
import json
import os
@changsijay
changsijay / wget.sh
Created August 6, 2020 13:21 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@changsijay
changsijay / install_janus.sh
Created August 17, 2020 03:45 — forked from anildigital/install_janus.sh
Install Janus WebRTC Gateway on macOS
brew install jansson libnice openssl libusrsctp libmicrohttpd libwebsockets cmake rabbitmq-c sofia-sip opus libogg glib pkg-config gengetopt
wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
tar xvf v1.5.4.tar.gz
cd libsrtp-1.5.4
./configure --prefix=/usr/local/libsrtp
make
sudo make install
git clone [email protected]:meetecho/janus-gateway.git
@changsijay
changsijay / main.go
Created June 22, 2021 19:14 — forked from metafeather/main.go
Get goroutine id for debugging
# ref: https://play.golang.org/p/OeEmT_CXyO
package main
import (
"fmt"
"runtime"
"strconv"
"strings"
"sync"
)