Skip to content

Instantly share code, notes, and snippets.

View chuck-sys's full-sized avatar

Cheuk Yin Ng chuck-sys

View GitHub Profile
@chuck-sys
chuck-sys / lightning_test.py
Created March 24, 2015 02:16
Lightning effects testing
#!/usr/bin/env python
# File: lightning_test.py
# Description: Using pygame to test lightning effects to
# follow the mouse/cursor.
import pygame, sys, math, random
from pygame.locals import *
SIZE = (1000, 500)
HSIZE = [x/2 for x in SIZE]
MINDIST = 10 # The minimum distance to stop
@chuck-sys
chuck-sys / turret_test.py
Last active August 29, 2015 14:17
Turret Test
#!/usr/bin/env python
# File: turret_test.py
# Description: Some turret testing for tower defense games
import pygame, sys, math
from pygame.locals import *
pygame.init()
surface = pygame.display.set_mode((500, 500))
pygame.display.set_caption('Turret Test')
@chuck-sys
chuck-sys / music.bas
Created June 23, 2016 04:02
qbasic file that plays music
' FILE: MUSIC.BAS
CLS
SCREEN 13
PLAY "MB"
PLAY "T255" 'TEMPO: 255
MUSIC1$ = "O2 F8 F8 F+8 F8 G+8 G+8 F+8 F4 F8 F+8 F8 O3 C#8 C#8 O2 B8 A#8"
MUSIC2$ = "O2 F8 F8 F+8 F8 G+8 G+8 F+8 F4 F8 F+8 F8 O3 F8 F8 D#8 C#8"
' FLAG FOR WHICH STRING OF NOTES TO PLAY
@chuck-sys
chuck-sys / pepcoilParser.pl
Last active March 16, 2017 16:29
Bioinformatics
##################################################################################
# DESCRIPTION : This program parses pepcoil output so that the file can be
# opened into an Excel spreadsheet
#
# USAGE :
#
# AUTHOR : Chris Hobbs
# DATE : December 28, 2013
#
####################################################################################
(ns human-readable)
(def quantities ["year" "day" "hour" "minute" "second"])
(defn quantisize [q n]
(if (= n 1)
[n q]
[n (str q "s")]))
(defn inter-last [v]
@chuck-sys
chuck-sys / unforce.js
Last active February 12, 2018 01:22
Unforce Download - A Greasemonkey script that removes force-download links from your moodle page.
// ==UserScript==
// @name Unforce Download
// @author chucksys
// @namespace https://gist.github.com/cheukyin699/a1eee44f3b76e365b842665d0a93b232
// @version 1
// @include https://learn.twu.ca/mod/assign/*
// ==/UserScript==
var links = document.getElementsByTagName("a");
for (let link of links) {
@chuck-sys
chuck-sys / jarvis.sh
Created April 24, 2018 04:51
Jarvis adapter for rofi popup windows
#!/usr/bin/env bash
jarvis <<- EOF
$@
quit
EOF
@chuck-sys
chuck-sys / README.md
Last active August 9, 2018 18:35
Whatsapp data cruncher

Tested with Python 3. Doesn't work with Python 2 unless you change some of the format specifiers.

This script outputs to standard output in TSV format, and thus can be easily imported into any spreadsheet program for easy data visualization. I import it into Google Sheets, and do stuff there.

Feel free to add more analysis things.

@chuck-sys
chuck-sys / README.md
Last active May 14, 2018 22:49
Facebook Messenger message analyzer

Tested with Python 3.

BeautifulSoup is required to parse the HTML that the individual messages are in.

To use, first download a copy of your Facebook data. Then, run this script with the directory of all of your messages (usually something like /messages/). The analysis will come out through the standard output in CSV format, for easy importing into your favourite spreadsheet for analysis.

I would recommend adding separate columns after importing into your favourite spreadsheet for analysis. You may also (if you want to) train a neural network on the natural language (however basic and abbreviated).

@chuck-sys
chuck-sys / main.cc
Created April 11, 2019 23:08
ffmpeg tutorial
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
#include <cstdio>
#include <string>
#include <fstream>
#include <iostream>