Skip to content

Instantly share code, notes, and snippets.

View daffodilistic's full-sized avatar

T. H. Soh daffodilistic

View GitHub Profile
@daffodilistic
daffodilistic / RaySatWatchDog.au3
Created June 18, 2014 06:50
Maya Mental Ray Satellite Watchdog
; NOTE - run this in SYSTEM account! Use Task Scheduler or System Service!
RaySatWatchdog()
Func RaySatWatchdog()
While 1 ; Opens up a WHILE loop, with 1 as a constant, so it is infinite
Local $aProcessList = ProcessList("raysat2014.exe")
For $i = 1 To $aProcessList[0][0]
ProcessSetPriority ( $aProcessList[$i][1] , 0 )
Next
@daffodilistic
daffodilistic / Mod3And5.java
Last active June 27, 2017 01:56
EDMW is a mean and scary place
public class Mod3And5 {
public static void main(String args[]) {
for (int i = 1; i <= 100; i++) {
String out = "";
if (i % 3 == 0) {
out += "Fizz";
}
if (i % 5 == 0) {
out += "Buzz";
}
@daffodilistic
daffodilistic / Debug.js
Last active May 4, 2021 07:20
Override Chrome's console object with debug package
import debug from 'debug';
// HOW TO USE THIS:
// 1) import console from './helpers/DebugHelper'
// 2) set localStorage key: "debug" to "hello-world:*"
export default class console {
static DEBUG_KEY = "hello-world";
static log(args) {
const logger = debug(console.DEBUG_KEY + ":log");
@daffodilistic
daffodilistic / myapp_azurewebsites.conf
Created June 3, 2020 14:24
Nginx Reverse Proxy to azurewebsites.net on an IPv6 Host behind CloudFlare
# Nginx configuration file for a simple reverse proxy from a domain to azurewebsites.net
# References: https://withouttheloop.com/articles/2017-07-23-nginx-letsencrypt-azure-web-app/
# Note: Ensure your AAAA records for your domain under CloudFlare are configured!
# A records are not needed since Cloudflare will be proxying IPv6 to IPv4 requests for us.
server {
listen 80;
listen [::]:80;
server_name myapp.site www.myapp.site;
@daffodilistic
daffodilistic / app_passwd_auth.php
Created March 17, 2021 09:51
Basic plugin to demonstrate enabling application passwords and REST endpoint security via HTTP Basic auth
<?php
/**
* Plugin Name: Application Password and REST Authentication Test Plugin
* Description: Basic plugin to demonstrate enabling application passwords and REST endpoint security via HTTP Basic auth
* Version: 0.1.0
* Requires at least: 5.6
* Author URI: https://github.com/daffodilistic/
* Author: Soh Thiam Hing
* License: The Unlicense
@daffodilistic
daffodilistic / copy_es.sh
Created April 13, 2021 09:49
Dump and Restore ElasticSearch documents and indices
#!/bin/bash
elasticdump --input=$1 --output=$2 \
--type=analyzer --concurrencyInterval=500
curl -X POST "$2/_open?pretty"
elasticdump --input=$1 --output=$2 \
--type=mapping --concurrencyInterval=500
elasticdump --input=$1 --output=$2 \
--type=data --concurrencyInterval=500
@daffodilistic
daffodilistic / keepalive.py
Last active April 28, 2021 13:13
Keeps a GCP instance alive. Useful for preemptible instances
import os
from googleapiclient import discovery
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "./service-account-key.json"
HOSTNAME = "example.com"
GCP_PROJECT = 'project_name'
GCP_INSTANCE_ZONE = 'instance_zone'
GCP_INSTANCE_NAME = 'instance_name'
@daffodilistic
daffodilistic / backup_sql.py
Last active June 23, 2021 07:37
Automatically dump SQL data to Google Cloud Storage
#!/usr/bin/env python
import subprocess
import os
import pipes
import argparse
from zipfile import ZipFile
from google.cloud import storage
from datetime import datetime
parser = argparse.ArgumentParser()
@daffodilistic
daffodilistic / odoo.service
Created May 26, 2021 05:58
Systemd unit to start a docker container with proper logging
[Unit]
Description=Odoo Docker Container Service
Requires=docker.service network.target
After=docker.service network.target
[Service]
Type=exec
User=root
Group=google-sudoers
WorkingDirectory=/var/docker
@daffodilistic
daffodilistic / usbgadget_razer.sh
Created August 23, 2021 04:39 — forked from tothi/usbgadget_razer.sh
Razer USB gadget on Android for Local Privilege Escalation on Windows
# MINIMAL USB gadget setup using CONFIGFS for simulating Razer Gaming HID
# devices for triggering the vulnerable Windows Driver installer
# credits for the Windows Driver install vuln: @j0nh4t
#
# https://twitter.com/j0nh4t/status/1429049506021138437
# https://twitter.com/an0n_r0/status/1429263450748895236
#
# the script was developed & tested on Android LineageOS 18.1