Skip to content

Instantly share code, notes, and snippets.

View jetsanix's full-sized avatar
💭
💭💭💭

jet tsang zeon-git jetsanix

💭
💭💭💭
View GitHub Profile
@jetsanix
jetsanix / doh.js
Created August 11, 2025 20:40
A DNS-over-HTTPS (DoH) reverse proxy, with special handling for Ethereum (.eth) and Solana (.sol) domains for NGINX
/*
* NJS script to implement a DNS‑over‑HTTPS (DoH) reverse proxy with
* special handling for Ethereum (.eth) and Solana (.sol) domains.
*
* When a request hits `/dns‑query` the `handle()` function determines
* the queried name and record type. Standard RFC 8484 GET requests
* include a `?dns=` parameter containing a Base64Url encoded DNS
* message, while the JSON API uses `?name=` and `?type=` parameters
* for textual queries. POST requests carry a raw DNS message with
* `Content‑Type: application/dns‑message`【742873960042857†L96-L108】. The
@jetsanix
jetsanix / .tmux.conf
Last active April 8, 2020 03:53
my tmux
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-style bg=colour235 #base02
set-option -g status-style fg=colour136 #yellow
# set window split
bind-key v split-window -h
bind-key b split-window
# default window title colors
# Basic Strongswan ikev2 server setup
* paltform: atlantic.net ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
```
apt-get install strongswan
apt-get install iptables iptables-persistent
```
count = 0;
jQuery(".time").each(function(){
var $t = jQuery(this);
var $del = $t.parent().parent().find('a.delete');
jQuery.ajax({
type: 'POST',
url: location.href,
data: {
action: 'msg.del',
msg: $t.attr('ffid'),
#!/bin/sh
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
@jetsanix
jetsanix / podcast_downloader.py
Last active December 17, 2015 18:18
podcast downloader (with password)
#!/usr/bin/env python
# encoding: utf-8
# edit from https://github.com/hrktir/download_podcast_mp3/blob/master/download_podcast_mp3.py
# echo "http://podcasturl/xml podname" >> urls.txt # one podcast rss in each line
# python podcast_downloader.py urls.txt
import urllib2
from xml.dom.minidom import parse
import time
#!/usr/bin/env python
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "3.1"
__author__ = "Aaron Swartz ([email protected])"
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"]
# TODO:
# Support decoded entities with unifiable.
@jetsanix
jetsanix / html5-notifications.md
Created July 12, 2012 09:22
OS X Notification Center in Safari 6 & Chrome 21+

OS X Notification Center in Safari 6 & Chrome 21+

OS X Mountain Lion adds Notification Center for managing alerts. Just like growl, but better.

Safari 6 and latest Chrome (21+) expose HTML5 notifications API to sites. Every site need to have permission for showing notifications.

Specification is very new and completely different from older version Chrome had. Developer doesn't have to watch for complicated NotificationCenter.

The syntax is very simple:

@jetsanix
jetsanix / alphatown.js
Created August 31, 2011 20:22
alphatown map on
/* paste and run on chrome */
for(i=100;i<6000;i++){
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","http://alphatown.com/api/node/"+i+"/info?sync=true&d=1314820793143&p=&w=191&oz_tm=_alphatown_api_handler______3380______1314820793143",true);
xmlhttp.send();
}
@jetsanix
jetsanix / parallets.sh
Created August 9, 2011 05:50
Parallels on lion
#!/bin/sh
sudo kextutil "/Library/Parallels/Parallels Service.app/Contents/Kexts/10.6/prl_hypervisor.kext"
sudo kextutil "/Library/Parallels/Parallels Service.app/Contents/Kexts/10.6/prl_hid_hook.kext"
sudo kextutil "/Library/Parallels/Parallels Service.app/Contents/Kexts/10.6/prl_usb_connect.kext"
sudo kextutil "/Library/Parallels/Parallels Service.app/Contents/Kexts/10.6/prl_netbridge.kext"
sudo kextutil "/Library/Parallels/Parallels Service.app/Contents/Kexts/10.6/prl_vnic.kext"