Skip to content

Instantly share code, notes, and snippets.

View evandrix's full-sized avatar
💭
offline

evandrix evandrix

💭
offline
View GitHub Profile
@evandrix
evandrix / pep20_by_example.py
Created March 13, 2012 18:45
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@evandrix
evandrix / README.md
Created September 11, 2012 00:06
Headless web browsers

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@evandrix
evandrix / gist:1130954
Created August 7, 2011 23:57
Programmer's Links: Basics
@ http://altdevblogaday.com/2011/08/06/demise-low-level-programmer/
Floating Point Numbers
They are very useful but often used in situations where they simply don’t suit the solution the programmer is attempting to write. The following links should provide some background and info on where they are not so useful, what the pitfalls are and sometimes even how to avoid them.
http://www.cprogramming.com/tutorial.html#fptutorial
http://www.johndcook.com/blog/2009/04/06/numbers-are-a-leaky-abstraction/
http://www.codeproject.com/KB/recipes/float_point.aspx
http://drdobbs.com/184402741?pgno=4
http://users.tkk.fi/jhi/infnan.html
@evandrix
evandrix / gist:1901352
Created February 24, 2012 14:40 — forked from michaelpetrov/gist:1899630
Stripe CTF Challenge - Solutions to all Levels
Stripe CTF - Work Notes
mpetrov (petrov.michael@gmail.com)
These notes are very rough. They should give a general idea of how each level was solved.
---- LEVEL 01 (login: e9gx26YEb2) -----
Solution: modifying PATH env variable
Password: kxlVXUvzv
date.c
@evandrix
evandrix / invsqrt.c
Created October 15, 2011 21:57
Quake: Inverse Sqrt
float InvSqrt(float x){
float xhalf = 0.5f * x;
int i = *(int*)&x; // store floating-point bits in integer
i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
x = *(float*)&i; // convert new bits into float
x = x*(1.5f - xhalf*x*x); // One round of Newton's method
return x;
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:label="@string/app_name">
Writing to Memory
Exploiting format string vulnerabilities is all about providing input that uses a format character that expects its value to be passed by reference and you control that reference. I used ‘%s’ to read from memory. I’m going to use %n to write to memory.
%n Number of characters written by this printf.
Lucky for us, there is a really easy way to control the number of characters written by printf. When you specify a format character, you can optionally give it an integer for the width of the format character.
%#x Number of characters prepended as padding.
We can use this to control how many characters are written by printf.
@evandrix
evandrix / README.md
Created December 29, 2013 15:44
Gmail API

Gmail.js - JavaScript API for Gmail

TL;DR Summary

  • Lots of api methods to work with gmail. Useful for chrome extensions
  • Most of them dont take arguments, they work on what is currently visible on the screen
  • I still need to add implementation for chrome extension, works by injecting js for now
  • Main method is gmail.observe.on('lots_of_actions_here', callback())
  • Click on a method link to view more detailed docs
  • Create an issue/pull request for feedback, requests and fixes
@evandrix
evandrix / print_dir_tree.py
Created July 21, 2011 14:38
Print Directory Tree Structure (with/without files)
#! /usr/bin/env python
# tree.py
#
# Written by Doug Dahms
#
# Prints the tree structure for the path specified on the command line
from os import listdir, sep
from os.path import abspath, basename, isdir
@evandrix
evandrix / p438.cpp
Created January 11, 2014 18:17
Project Euler Problem 438
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <cstring>
using namespace std;
/**
* Problem 438
*
* Example: