Skip to content

Instantly share code, notes, and snippets.

View jsyeo's full-sized avatar
💭
💍 𝔁𝓾𝓮🥶𝓱𝓾𝓪:female_fairy:𝓹𝓲𝓪𝓸😻𝓹𝓲𝓪𝓸👣

Jason Yeo jsyeo

💭
💍 𝔁𝓾𝓮🥶𝓱𝓾𝓪:female_fairy:𝓹𝓲𝓪𝓸😻𝓹𝓲𝓪𝓸👣
View GitHub Profile
@jsyeo
jsyeo / GetODJ.py
Created July 17, 2012 19:04
Collecting meta data of ODJ articles
#!/usr/bin/python -tt
import urllib
from lxml import etree
import simplejson
def main():
'''main method:
code here'''
f = urllib.urlopen("http://ymiblogging.org/category/devotional/odj/")
@jsyeo
jsyeo / power_now.py
Created July 20, 2012 07:28
Python Script To Print Current Laptop Battery Power
#!/usr/bin/python
def main():
power_now = open("/sys/class/power_supply/BAT0/energy_now", "r").readline()
power_full = open("/sys/class/power_supply/BAT0/energy_full", "r").readline()
print float(power_now)/float(power_full) * 100 , "%"
if __name__ == "__main__":
main()
@jsyeo
jsyeo / Fib.java
Created October 17, 2012 19:10
Fibonacci Continuation Passing Style in Java
interface Cont {
int k(int v);
}
public class Fib {
public static void main(String args[]){
String res = "";
int arr[] = {0,1,2,3,4,5,6,7,8,10};
for (int elem:arr) {
res += (fib(elem,
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jsyeo
jsyeo / lambda.hs
Created April 4, 2013 04:29
Lambda calculus in less than 20 lines of code.
type Var = String
type Env = [(Var, Term)]
data Term = Var Var
| Lambda Var Term
| Apply Term Term
| Closure Env Var Term
deriving(Show)
varLookup ((v,t):env) var = if var == v then
t
@jsyeo
jsyeo / lambda.hs
Created April 4, 2013 06:43
Lambda calculus evaluator extended with some primitive values and operations. Recursion is achieved in the language using the y combinator.
import Debug.Trace
type Var = String
type Env = [(Var, Expr)]
data Expr = Var Var
| BoolConst Bool
| IntConst Int
| Mult Expr Expr
| Minus Expr Expr
| Equality Expr Expr
| Cond Expr Expr Expr
@jsyeo
jsyeo / default.pac
Created June 6, 2013 22:27
mediahint's default.pac
function FindProxyForURL(url, host){
var country = 'CA';
var myip = myIpAddress();
var ipbits = myip.split('.');
var myseg = parseInt(ipbits[3]);
var p = [3223469900, 3223469902, 3226589467, 628805681, 3335744412];
for(var i in p){
n = p[i];
var d = n%256;
for(var j = 3; j > 0; j--){
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD4 Message
* Digest Algorithm, as defined in RFC 1320.
* Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
@jsyeo
jsyeo / install_dist_pip.bat
Last active February 15, 2022 05:10
Batch file to create virtualenv, download and install distribute + pip on Windows 7 machines (Python 3.3)
cd %USERPROFILE%
REM create the venv
C:\Python33\python.exe C:\Python33\Tools\Scripts\pyvenv.py %USERPROFILE%\venv
REM download get-pip.py and distribute_setup.py
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py','%USERPROFILE%\get-pip.py')
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
#
# http://metasploit.com/
##
require 'shellwords'
class Metasploit3 < Msf::Exploit::Local