Skip to content

Instantly share code, notes, and snippets.

View chen420's full-sized avatar

Hong Chen chen420

View GitHub Profile
@chen420
chen420 / arduino101-balancing.ino
Created November 30, 2017 11:43 — forked from nazt/arduino101-balancing.ino
arduino101-balancing.ino
/*
The MIT License (MIT)
Copyright (c) 2016 Chiang Mai Maker Club
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
// ==UserScript==
// @name Aliexpress
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://trade.aliexpress.com/orderList.htm*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
@chen420
chen420 / getIP.gs
Created February 23, 2020 13:12 — forked from einichi/getIP.gs
Get IP Address of Hostname - Google App Script
function getIP(host, recordType) {
// Specify record type as per described here: https://en.wikipedia.org/wiki/List_of_DNS_record_types
// For example, 'A', 'AAAA', 'NS', etc...
// So your Google Sheets formula would be =getIP("www.example.com", "A")
var url = "https://dns.google.com/resolve?name=" + host + "&type=" + recordType;
var json = UrlFetchApp.fetch(url);
var response = JSON.parse(json);
var answer = response.Answer;
var ip = "";
if (typeof answer != "undefined") {
@chen420
chen420 / rc.local
Last active November 18, 2022 04:33 — forked from IanMercer/rc.local
Automatic hostnames for Raspberry Pi instead of all 'raspberrypi'
# If you have many Raspberry Pis that you want to setup from a common image,
# add this to `/etc/rc.local` before you create the image, but do not run it.
# On first-run it will change the name from `raspberrypi` to `chlab-XXXXXX` where XXXXXX
# is the serial number of the Raspberry Pi. (Change 'chlab' in the line below.)
MAC="chlab-""$(grep 'Serial' /proc/cpuinfo | sed 's/^Serial.*000\([1-9a-f][0-9a-f]*\)$/\1/')"
CURRENT_HOSTNAME=$(cat /proc/sys/kernel/hostname)
if [ $CURRENT_HOSTNAME != $MAC ]
@chen420
chen420 / mastodon-docker-setup.md
Created January 1, 2023 15:36 — forked from TrillCyborg/mastodon-docker-setup.md
Mastodon Docker Setup

Mastodon Docker Setup

Setting up

Clone Mastodon's repository.

# Clone mastodon to ~/live directory
git clone https://github.com/tootsuite/mastodon.git live
# Change directory to ~/live

cd ~/live