Skip to content

Instantly share code, notes, and snippets.

View fishy's full-sized avatar

Yuxuan 'fishy' Wang fishy

View GitHub Profile
@fishy
fishy / README.md
Last active June 15, 2023 03:28
Render static HTML files from mysqldump of NucleusCMS

Render static HTML files from mysqldump of NucleusCMS

Go code to render static HTML files from mysqldump of NucleusCMS.

Note that it requires you to use --complete-insert arg with mysqldump.

@fishy
fishy / README.md
Last active January 10, 2022 01:50
oauth2.py for Python3

oauth2.py for Python 3

The first version of oauth2.py was unmodified from upstream. The following commit(s) updated it for Python3. Tested with Python 3.8.6 on Debian Bullseye.

@fishy
fishy / switch-auto-off.groovy
Last active October 1, 2019 04:46
SmartThings SmartApp: auto turn off switch after N minutes
/**
* Switch Auto Off.
*
* Copyright 2019 Yuxuan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@fishy
fishy / presence-and-garage-door.groovy
Last active October 10, 2018 06:05
SmartThings smartapp for garage door automation
/**
* Presence and Garage Door
*
* Copyright 2016 Yuxuan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@fishy
fishy / myq.groovy
Last active March 3, 2019 05:06
MyQ Garage SmartThings device handler
/**
* MyQ Garage Door
*
* Copyright 2018 Yuxuan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@fishy
fishy / equal_test.go
Last active March 30, 2019 01:09
Go: bytes.Equal vs. reflect.DeepEqual (vs. self-implemented equal) (https://wang.yuxuan.org/blog/item/2017/02/comparing-byte-s-in-go)
package main_test
import (
"bytes"
"fmt"
"math/rand"
"os"
"reflect"
"testing"
"time"
import sys
last_line = ''
for line in sys.stdin.xreadlines():
length = len(last_line.rstrip())
if length != len(line.rstrip()) or length == 0:
sys.stdout.write(last_line)
last_line = line
continue
if line.count("=") == length:
Gerrit Code Review - /changes/ REST API
=======================================
This page describes the change related REST endpoints.
Please also take note of the general information on the
link:rest-api.html[REST API].
[[change-endpoints]]
Change Endpoints
----------------
@fishy
fishy / refapp.sh
Created June 1, 2012 03:29
If your Applications Stack is sorted by Date Added in your Dock, use this script after you dragged some new app from a DMG.
#!/bin/sh
TMPFILE=deadbeef`openssl rand -hex 14`
touch /Applications/${TMPFILE}
sleep 1
rm /Applications/${TMPFILE}