Skip to content

Instantly share code, notes, and snippets.

🔒
Securing things

Ambrose Chua serverwentdown

🔒
Securing things
Block or report user

Report or block serverwentdown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@serverwentdown
serverwentdown / cleanup
Created Sep 19, 2019
A bash script to normalise course documents.
View cleanup
#!/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 - ~')"
View base4dna.py
s = 'actgactgactggatc'
m = {
'a': 0,
'c': 1,
't': 2,
'g': 3
}
bytestring = []
@serverwentdown
serverwentdown / extra_tabs.tmpl
Last active Aug 2, 2019
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
View extra_tabs.tmpl
<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;
View pwd.py
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 / keyboard_pcap.py
Last active Sep 15, 2018 — forked from shahril96/keyboard_pcap.py
USB HID PCAP parser for HITB GSEC .edu 2018 - VValueCiphered
View keyboard_pcap.py
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 Dec 2, 2017
A simple tool to split files into chunks.
View split.go
package main
import (
"fmt"
"text/template"
"bytes"
"io"
"os"
"github.com/c2h5oh/datasize"
@serverwentdown
serverwentdown / cdtea.ino
Last active Apr 20, 2017
https://www.instagram.com/p/BTHUAkggVJy/ cdtea based on github.com/achilikin/cdtea
View cdtea.ino
#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,
View keybase.md

Keybase proof

I hereby claim:

  • I am serverwentdown on github.
  • I am serverwentdown (https://keybase.io/serverwentdown) on keybase.
  • I have a public key whose fingerprint is AE67 7CFF 65D9 84EB 1F0D C24C DB3F FE06 4995 FE8D

To claim this, I am signing this object:

@serverwentdown
serverwentdown / arrival.js
Last active Sep 25, 2016
Quick and dirty Node.js library for LTA's Arrival API
View arrival.js
"use strict";
/* jshint esversion: 6 */
/* jshint node: true */
const fs = require("fs");
const url = require("url");
const http = require("http");
const path = require("path");
const querystring = require("querystring");
View package.json
{
"name": "Cleanflight Configurator",
"description": "",
"version": "0.1.0",
"main": "main.html",
"default_locale": "en"
}
You can’t perform that action at this time.