Skip to content

Instantly share code, notes, and snippets.

@glacjay
glacjay / soft-layers.ahk
Last active January 5, 2022 02:20
simulate multi-layer keyboard
View soft-layers.ahk
#inputlevel,2
; Esc | LCtrl
$LCtrl::
SetMouseDelay -1
Send {Blind}{LCtrl DownR}
KeyWait, LCtrl
Send {Blind}{LCtrl up}
; MsgBox, %A_ThisHotkey%-%A_TimeSinceThisHotkey%
if (A_ThisHotkey="$LCtrl" and A_TimeSinceThisHotkey < 250)
View youtube_playlist_cleaner.user.js
// ==UserScript==
// @name youtube playlist cleaner
// @namespace http://tampermonkey.net/
// @version 0.2
// @description add a filter button to filter out watched videos
// @author GlacJAY <glacjay@gmail.com>
// @match https://www.youtube.com/playlist?list=*
// @grant none
// ==/UserScript==
@glacjay
glacjay / wubi86_single.py
Created January 27, 2021 08:50
制作 rime 五笔86 单字词库
View wubi86_single.py
# forked from https://github.com/yekingyan/rime-wubi-86-single/blob/master/wubi86_single.py
import re
INPUT_FILE_PATH = "wubi86.dict.yaml"
OUTPUT_FILE_PATH = "wubi86.dict.yaml.single"
@glacjay
glacjay / IframeDemo.vue
Last active January 7, 2018 09:20
vue 集成 iframe
View IframeDemo.vue
<template>
<iframe :src="the_url" @load="onIframeLoad" />
</template>
<script>
export default {
data () {
return {
the_url: "http://xxx.com/yyy",
some_id: 42
@glacjay
glacjay / sudoku.go
Created July 9, 2011 10:35
Solve Sudoku problems in Go.
View sudoku.go
package main
import (
"io/ioutil"
"log"
"os"
"regexp"
"strings"
)
@glacjay
glacjay / gist:856270
Created March 5, 2011 09:59
A simple tool to find out a particular machine's IP address within a LAN.
View gist:856270
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <unistd.h>
#include <arpa/inet.h>
@glacjay
glacjay / gist:856140
Created March 5, 2011 05:13
Show a problem about CR/LF under Linux.
View gist:856140
# Save this file using DOS's CR/LF.
export VAR1=blahblahblah
export VAR2=hello
export VAR1=$VAR1:$VAR2
@glacjay
glacjay / tun-ping-win.py
Created September 19, 2010 16:24
Reading/Writing OpenVPN's TUN/TAP Device under Windows using Python.
View tun-ping-win.py
import _winreg as reg
import win32file
adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
def get_device_guid():
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters:
try:
@glacjay
glacjay / tun-ping-mac.go
Created September 19, 2010 16:03
Reading/Writing Mac's TUN/TAP device using Go.
View tun-ping-mac.go
package main
import (
"exec"
"log"
"os"
)
func main() {
file, err := os.Open("/dev/tun0", os.O_RDWR, 0)
@glacjay
glacjay / tun-ping-mac.py
Created September 19, 2010 15:59
Reading/writing Mac's TUN/TAP device using Python.
View tun-ping-mac.py
import os
import subprocess
# Open file corresponding to the TUN device.
tun = open('/dev/tun0', 'r+b')
# Bring it up and assign addresses.
subprocess.check_call('ifconfig tun0 192.168.7.1 192.168.7.2 up', shell=True)