Skip to content

Instantly share code, notes, and snippets.

@lifehome
lifehome / 0001-Adhoc-patch-to-add-Whatsapp-button-for-contacting-cu.patch
Created Apr 29, 2021
Very dirty patch to add Whatsapp contact button, Hong Kong area code hardcoded
View 0001-Adhoc-patch-to-add-Whatsapp-button-for-contacting-cu.patch
From f9482c5c0c2da037acf3c08942be711df630dc95 Mon Sep 17 00:00:00 2001
From: Ivan Ip <m@lifeho.me>
Date: Thu, 29 Apr 2021 23:07:42 +0800
Subject: [PATCH] Adhoc patch to add Whatsapp button for contacting customer
---
.../BillingInformationViewController.swift | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/BillingInformationViewController.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/BillingInformationViewController.swift
@lifehome
lifehome / aria2_torrentadder.sh
Last active Apr 9, 2021
aria2 auto add torrent script for inotify - bash - licensed on AGPL-3.0
View aria2_torrentadder.sh
#!/bin/bash
aria2PROTOCOL="http"
aria2HOST="127.0.0.1"
aria2PORT="6800"
aria2TOKEN="1234567890abcdef"
aria2ENDPOINT="/jsonrpc"
discordNotification=true
discordActorUsername="Aria2 Torrent Automator"
@lifehome
lifehome / https-fpm.incl
Last active Aug 17, 2019
Default NGINX Configurations
View https-fpm.incl
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param HTTPS true;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
@lifehome
lifehome / README.md
Last active May 8, 2021 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
View README.md

Cloudflare DDNS bash client with systemd

This is a bash script to act as a Cloudflare DDNS client, useful replacement for ddclient.

Look out!

A newer version is available!

This gist will no longer update, instead please go to https://github.com/lifehome/systemd-cfddns for more updated versions.

How to use?

  1. Put the cfupdater files to /usr/local/bin
  • If you are using IPv4 for A record, append -v4 to cfupdater in the following systemd service unit.
View jumboapi.js
const fs = require('fs'),
maths = require('mathjs'),
restify = require('restify'),
rp = require('request-promise'),
cheerio = require('cheerio'),
cheerioTableparser = require('cheerio-tableparser')
server = restify.createServer({
name: 'wrench-jumbo',
version: '1.0.1'
}),
@lifehome
lifehome / station.json
Last active Jul 29, 2017
MTR Stations listing
View station.json
{
"HUH": {
"vid": "000",
"en_name": "Hung Hom",
"zh_name": "紅磡"
},
"MKK": {
"vid": "001",
"en_name": "Mong Kok East",
"zh_name": "旺角東"
@lifehome
lifehome / Probability-v4.js
Last active Oct 23, 2016
ES2015 written script, use with caution.
View Probability-v4.js
/* NOTICE: This file is written in ES2015.
* Please use the --harmony flag for nodejs environment.
*
* License: CC BY-SA 4.0 by Ivan Ip<m@lifeho.me>
*/
var iconv = require('iconv-lite'),
request = require('request'),
cheerio = require('cheerio'),
cheerioTableparser = require('cheerio-tableparser'),
@lifehome
lifehome / webhook.gs
Created Aug 24, 2016
Google Forms + Webhook : JSON example
View webhook.gs
function onFormSubmit(e) {
var data = {
"form": {
"id": e.source.getId(),
"title": e.source.getTitle() ? e.source.getTitle() : "Untitled Form",
"is_private": e.source.requiresLogin(),
"is_published": e.source.isAcceptingResponses(),
},
"response": {
"id": e.response.getId(),
View keybase.md

Keybase proof

I hereby claim:

  • I am lifehome on github.
  • I am lifehome (https://keybase.io/lifehome) on keybase.
  • I have a public key whose fingerprint is 8248 46E2 166F 8EEE DB94 301B CD6B 42C3 56D7 BEF6

To claim this, I am signing this object:

View gist:aaed76348a92579d9af7
避難所、物資站及救護站更新
https://docs.google.com/document/d/1YepRdBZKcGNjUC6QcopmG7_jpaOucxbGxlQJOwI7BxM/pub
Latest list:
http://appsrv.cse.cuhk.edu.hk/~acmprog/
Latest data please read this map: https://www.google.com/maps/d/u/0/embed?mid=zIh97OmUhBNA.kGMqBtuPdCO4
各區物資需求表︰
https://docs.google.com/spreadsheets/d/1psp1mPDWoT29KAcjuBrbywNumUvBEPNJG5tuUjJ8uaQ/pubhtml