Skip to content

Instantly share code, notes, and snippets.

@wujiang
wujiang / earth_moon_retainer.stl
Created May 24, 2021 02:45
earth_moon_retainer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wujiang
wujiang / zoom-mute-status.scpt
Created May 18, 2021 20:58 — forked from tyzbit/zoom-mute-status.scpt
Get Zoom Mute/Unmute Status
property btnTitle : "Mute audio"
tell application "System Events" to tell application process "zoom.us"
if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
do shell script "echo Unmuted"
else
do shell script "echo Muted"
end if
end tell
@wujiang
wujiang / ulb16_test.py
Created January 29, 2019 03:16
ulb16_test
from canlib import canlib, Frame
from canlib.canlib import ChannelData
import time
import binascii
def setUpChannel(channel=0,
openFlags=canlib.canOPEN_ACCEPT_VIRTUAL,
bitrate=canlib.canBITRATE_500K,
bitrateFlags=canlib.canDRIVER_NORMAL):

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@wujiang
wujiang / mocha-done.js
Last active October 28, 2016 03:21
mocha-3.1.2 fails
var async = require('async');
describe('timer test', function() {
it('should not report done() called multiple times', function(done) {
async.waterfall([
(next) => {
var timer = setTimeout(() => {
next(null, 'timer1');
}, 2);
@wujiang
wujiang / postgres_queries_and_commands.sql
Created September 19, 2016 17:55 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
1 0.000000 192.168.240.1 -> 192.168.240.246 SSH 90 Client: Encrypted packet (len=36)
2 0.016909 192.168.240.246 -> 192.168.240.1 SSH 378 Server: Encrypted packet (len=324)
3 0.017047 192.168.240.1 -> 192.168.240.246 TCP 60 53034 → 22 [ACK] Seq=37 Ack=325 Win=65535 Len=0
4 0.020943 192.168.240.246 -> 192.168.240.1 SSH 378 Server: Encrypted packet (len=324)
5 0.021017 192.168.240.1 -> 192.168.240.246 TCP 60 53034 → 22 [ACK] Seq=37 Ack=649 Win=65535 Len=0
6 0.255947 192.168.240.1 -> 192.168.240.246 SSH 90 Client: Encrypted packet (len=36)
7 0.258920 192.168.240.246 -> 192.168.240.1 SSH 818 Server: Encrypted packet (len=764)
8 0.259036 192.168.240.1 -> 192.168.240.246 TCP 60 53034 → 22 [ACK] Seq=73 Ack=1413 Win=65535 Len=0
9 0.299001 192.168.240.246 -> 192.168.240.1 SSH 122 Server: Encrypted packet (len=68)
10 0.299101 192.168.240.1 -> 192.168.240.246 TCP 60 53034 → 22 [ACK] Seq=73 Ack=1481 Win=65535 Len=0
@wujiang
wujiang / googleforms2slack.gs
Created March 3, 2016 18:25 — forked from andychase/googleforms2slack.gs
Google Forms Slack Notification
// Google Forms Slack Notification
// Andy Chase <github.com/andychase>
// License: CC0 1.0 Universal <creativecommons.org/publicdomain/zero/1.0>
// Install 1: This code goes in ( tools > script editor... ) of your google docs form
// Install 2: ( resources > current project triggers ) ( [onSubmit], [from Form], [On form submit] )
// Setup 1: Put your slack api url below
var POST_URL = "https://hooks.slack.com/services/";
function onSubmit(e) {
class mapNode(object):
def __init__(self):
self.num = None
self.e = None
self.w = None
self.n = None
self.s = None
self.lock = None
def main():
@wujiang
wujiang / gist:cdf03b5a2d13af24b8a1
Created February 1, 2016 19:43
openbsd ifconfig
~ $ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
priority: 0
groups: lo
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:0c:29:81:a7:db
priority: 0