Skip to content

Instantly share code, notes, and snippets.

View serverwentdown's full-sized avatar

Ambrose Chua serverwentdown

View GitHub Profile
@serverwentdown
serverwentdown / github-latest-package.js
Created March 10, 2014 15:09
Random snippet to get latest links for GitHub releases.
var username = "github"; // Put username here
var repo = "ruby"; // Put repository name here
/*
That's it! Now use this URL format:
http://github.com/<username>/<repo>/releases#MyAwesomePackagedApp.zip
Where <username> and <repo> are exactly as defined in those variables, and MyAwesomePackagedApp.zip is whatever filename of the ZIP you uploaded in the "releases" page of your repository.
**DOES not work with source code downloads**
@serverwentdown
serverwentdown / typethis.js
Created May 8, 2014 12:47
Typing thingy...
process.stdin.setEncoding('utf8');
var str = "File I/O is provided by simple wrappers around standard POSIX functions. To use this module do require('fs'). All the methods have asynchronous and synchronous forms.";
console.log("Hello! ");
console.log("Type this out and press return: ");
console.log("--------------------------");
console.log(str);
console.log("--------------------------");
process.stdout.write("Press enter to start: ");
<!--
Feel free to edit this document!
-->
<!DOCTYPE html>
<html lang="en">
<head>
#!/bin/bash
#
# Very simple ping request spammer
#
# Usage:
# sudo ./pingspam.sh ipv6address datasize threads &
#
# eg: sudo ./pingspam.sh ::1 4096 40 &
#
@serverwentdown
serverwentdown / randomindex.html
Created August 23, 2014 16:19
Random jekyll post
---
title: random
---
<script>
var posts = [{% for post in site.posts %}"{{ post.url }}", {% endfor %}];
var id = Math.floor(Math.random() * posts.length);
window.location.href = posts[id];
</script>
@serverwentdown
serverwentdown / LAB_Makefile
Created August 31, 2014 08:14
Makefile for all my CS C labs
all:
for f in `find * -type d -maxdepth 0 ! -regex .`; do\
gcc -o $$f/main.o $$f/main.c;\
done;
@serverwentdown
serverwentdown / infocomm.html
Created September 1, 2014 12:53
Derping around
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>infocomm</title>
<style>
* {
padding: 0;
margin: 0;
}
@serverwentdown
serverwentdown / enc.b64.Makefile
Last active August 29, 2015 14:07
Jekyll _posts encryption Makefile, but can be reconfigured easily. Feedback please! 😄
SHELL := /bin/zsh
DIRECTORY = "_posts"
EXT_ENC = ".aes.b64"
EXT_FILE = ".md"
ENCRYPTION = "aes-128-cbc"
all: usage
usage:
@serverwentdown
serverwentdown / homesync.sh
Created October 12, 2014 14:17
keep your $HOME in sync
#!/bin/zsh
# CONFIG
SERVER="example.com"
# Don't put trailing slashes btw.
REMOTEDIRECTORY="" # Set to "backup" to push to home directory of remote user. WARNING: Beginning with "/" will push to the remote root directory.
LOCALDIRECTORY="$HOME"
# REMOTEUSER="ambrosechua"
LOG=".homesync.log"
@serverwentdown
serverwentdown / pa4.c
Created October 16, 2014 06:22
feel free to fork and improve, cos this is crappy code
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// #include <math.h>
#include <time.h>
#include <sys/time.h>// For `gettimeofday()`
#include <string.h>