Skip to content

Instantly share code, notes, and snippets.

@shouya
shouya / essay.tex
Last active December 15, 2015 21:08
ToK essay #2
\documentclass[a4]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{mla}
\begin{document}
\begin{mla}{Shou}{Ya}{Nathan Engquist}{Theory of Knowledge}{\today}
\phantom{first}
@shouya
shouya / math_hl_crawer.rb
Created March 31, 2013 18:21
IB Math HL Worked Solutions
1.upto(17) do |x|
1.upto(10) do |y|
url = "http://media.pearsoncmg.com/intl/ema/9780435074968_" \
"Garry_Wazir/workedsolutions/HL_Exercise_" \
"#{x}.#{y}_Worked_Solutions.pdf"
`wget -c #{url}`
end
url = "http://media.pearsoncmg.com/intl/ema/9780435074968_" \
"Garry_Wazir/workedsolutions/" \
@shouya
shouya / gist:5150960
Created March 13, 2013 10:38
formula to bezier curve through hand & maxima
x(l,x0) := if equal(l,1) then
x0[2] * t - x0[1] * t + x0[1]
else
expand(x(1,[x(l-1,makelist(x0[i],i,1,length(x0)-1)),
x(l-1,makelist(x0[i],i,2,length(x0)))]));
usage:
factor(x(2,[x[0],x[1],x[2]]));
@shouya
shouya / derivative.ss
Created March 10, 2013 18:36
Derivative finder. Inspired by SICP.
; -*- scheme -*-
(define (derivative expr var)
(cond
((number? expr) 0)
((variable? expr) (if (eq? expr var) 1 0))
((sum? expr)
(make-sum (derivative (addend expr) var)
(derivative (augend expr) var)))
@shouya
shouya / gist:5023178
Last active December 14, 2015 03:48
english homework

Macros

Original Text

permanent link

Scheme programs can define and use new derived expression types, called macros. Program-defined expression types have the syntax

(<keyword> <datum> ...)

where is an identifier that uniquely determines the

@shouya
shouya / smashthestack_logic.md
Created February 3, 2013 18:24
Having fun with smashthestack.org#logic

Level1

PHP backdoor(level1):

http://logic.smashthestack.org:8181/uploads/PHPJackal.php

Execute cat /home/level1/.bash_history and find password inside.

Level2

@shouya
shouya / init_repl.sh
Last active December 12, 2015 01:38
A wrapper of init script that does cleaning work and correct the mistyped init-level caused by excitement.
#!/bin/sh
##
## This file is for replace the typical init program, do some
## pre-checking work before shutting down or other stuff.
##
## Written by Shou Ya, at 23 June, 2012
##
##
@shouya
shouya / cas.sh
Created January 19, 2013 10:12
use C program code as a script.
#!/usr/bin/env bash
# -*- shell-script -*-
# cas - c as script
# A script which support act C language code as a script.
#
# Usage:
# cas [COMPILE_OPTIONS] [source_file] [EXECUTE_ARGUMENTS]
# the source_file should be appoint otherwise it'll use /dev/stdin automically.
#
@shouya
shouya / anki_helper.rb
Last active September 24, 2018 13:38
Connect anki flash card and colordict together! (see my github project shouya/anki-helper for the newer version of it)
#
# This script is a convenient tool that takes colordict history from stdin
# and filters all starred vocabularies, queries the dict for meaning, then outputs
# a file for anki to import.
#
# Requires:
# * sdcv (stardict commandline version)
#
#
# This script is licensed by WTFPL.
@shouya
shouya / UnLockPwd.c
Created December 16, 2012 19:03
Disassembly-ing LockPwd function!
int __stdcall UnLockPwd(int a1, int a2)
{
signed int v2; // esi@1
int v3; // edx@1
int v4; // ecx@1
signed int v5; // edi@1
int v6; // eax@2
int i; // esi@2
signed int j; // esi@6
signed int k; // esi@11