Skip to content

Instantly share code, notes, and snippets.

View serverwentdown's full-sized avatar

Ambrose Chua serverwentdown

View GitHub Profile

Comparing URL Query Parameter Parsers

Differences in parsers can result in security issues under certain circumstances. For example, cache poisoning.

Help me add to this list! Comment below

Source Key-value pair delimiters Issue
WHATWG Spec &
@serverwentdown
serverwentdown / IVARcluster.md
Last active May 4, 2020 16:12
IVARcluster, prices in SGD at time of commit.

To make it more interesting, this setup should include a variety of motherboards, SSDs, HDDs, memory and PSUs. I might start with one system, and build another one every 6 months. I forsee this list changing over time, but the base specifications are as follows:

  • CPU: >6 core, >4GHz
  • Storage: >256GB NVMe
  • Memory: >16GB, dual channel

Pricing Source:

Rack:

@serverwentdown
serverwentdown / cleanup
Created September 19, 2019 01:46
A bash script to normalise course documents.
#!/bin/bash
for file in */*; do
if ! [[ -f $file ]]; then
continue
fi
updated="$(echo $file | sed -E 's~^(([^/]*/)*)(ICT(-CSC)?[0-9]{4})?([- _]*)([^/]+)$~\1\6~')"
updated="$(echo $updated | sed -E 's~Chpt ?~Lect~')"
updated="$(echo $updated | sed -E 's~L(ecture|ect|ec|0)[- _]*0*([0-9]+)[- _]+~Lec\2 - ~')"
updated="$(echo $updated | sed -E 's~Lab[- _]*0*([0-9]+)[- _]+~Lab\1 - ~')"
s = 'actgactgactggatc'
m = {
'a': 0,
'c': 1,
't': 2,
'g': 3
}
bytestring = []
@serverwentdown
serverwentdown / extra_tabs.tmpl
Last active August 2, 2019 15:49
A custom template for Gitea to embed pages into tabs with an iframe. Requires the proper X-Frame-Options and Content-Security-Policy on the linked resource. The example below is how I use it for Drone. Install into data/gitea/templates/custom/extra_tabs.tmpl as described on https://docs.gitea.io/en-us/customizing-gitea/#customizing-gitea-pages
<a class="item" href="https://your.domain.here{{.RepoLink}}" data-iframe-tab="builds" title="Builds">
<i class="octicon octicon-gear"></i> <img src="https://your.domain.here/api/badges{{.RepoLink}}/status.svg?ref=refs/heads/master" style="width: auto">
</a>
<script>
document.addEventListener('DOMContentLoaded', () => {
const openFrame = (tab) => {
const name = tab.dataset.iframeTab;
const page = tab.href;
import random
import math
import string
import sys
import click
# correct horse battery staple
def load_dictionary(d="/usr/share/dict/words"):
f = open(d, "r")
@serverwentdown
serverwentdown / server.js
Last active January 29, 2019 20:18 — forked from mixonic/server.js
// Bug fixes for current versions.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io
@serverwentdown
serverwentdown / keyboard_pcap.py
Last active September 15, 2018 12:25 — forked from shahril96/keyboard_pcap.py
USB HID PCAP parser for HITB GSEC .edu 2018 - VValueCiphered
from scapy.all import *
from argparse import ArgumentParser
from sys import argv
from collections import OrderedDict
# USB HID Keyboard scan codes
# https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2
key_hid = {
0x00 : ['', ''], # no key pressed
0x04 : ['a', 'A'],
@serverwentdown
serverwentdown / split.go
Created December 2, 2017 06:32
A simple tool to split files into chunks.
package main
import (
"fmt"
"text/template"
"bytes"
"io"
"os"
"github.com/c2h5oh/datasize"
@serverwentdown
serverwentdown / cdtea.ino
Last active April 20, 2017 16:51
https://www.instagram.com/p/BTHUAkggVJy/ cdtea based on github.com/achilikin/cdtea
#define PIN_MDOWN D0
#define PIN_MUP D3
#define PIN_MSPEED D1
#define MSPEED 255
#define PIN_BUTTON D4
typedef enum {
TRAY_OPEN,
TRAY_OPENING,