Skip to content

Instantly share code, notes, and snippets.

View lifehome's full-sized avatar

lifehome lifehome

View GitHub Profile
@lifehome
lifehome / aria2_torrentadder.conf
Created November 5, 2023 15:36
aria2 auto add torrent config for inotify - bash - licensed on AGPL-3.0
# The directory to watch
WATCH_DIR=/.fresh_torrents
# Interval between command execution.
# Format: HH:MM:SS or just how many seconds
SETTLE_DURATION=5
# Execute command immediately if incoming changes have persisted for a spcified of time period.
# Format: HH:MM:SS or just how many seconds
MAX_WAIT_TIME=300
@lifehome
lifehome / sshd_config
Created August 8, 2023 15:28
20230808 sshd_config
### ###
# ----------------------------- #
# Service-wide configs #
# ----------------------------- #
### ###
# Listening port for the SSH server
Port 311
# Listening addresses
@lifehome
lifehome / 0001-Adhoc-patch-to-add-Whatsapp-button-for-contacting-cu.patch
Created April 29, 2021 15:14
Very dirty patch to add Whatsapp contact button, Hong Kong area code hardcoded
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 April 9, 2021 21:08
aria2 auto add torrent script for inotify - bash - licensed on AGPL-3.0
#!/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 August 23, 2022 10:20
Default NGINX Configurations
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 February 25, 2024 06:34 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash

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.
@lifehome
lifehome / jumboapi.js
Last active October 16, 2019 03:43
Jumbo API
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 April 16, 2023 20:13
MTR Stations listing
{
"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 October 23, 2016 03:04
ES2015 written script, use with caution.
/* 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 August 24, 2016 14:48
Google Forms + Webhook : JSON example
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(),