Skip to content

Instantly share code, notes, and snippets.

Sven Slootweg joepie91

Block or report user

Report or block joepie91

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 gist:3033934
//this function adds 3 to the number passed in
function addThree(x) {
return x + 3;
}
//this function takes a function and returns
//a function that runs the function it was passed,
//and then runs that function _again_ on the return
//value of the first call to the function.
//make sense? look at it until it does.
View gist:3034779
function addThree(x)
{
return x + 3;
}
// Method one.
original = 4;
y = addThree(original); // 4 + 3 = 7
z = addThree(y); // 7 + 3 = 10
@joepie91
joepie91 / gist:3118866
Created Jul 15, 2012
Testing variable assignments within if statements in PHP
View gist:3118866
<?php
function return_false()
{
return false;
}
function return_true()
{
return true;
View gist:5437565
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
/*
************************************************
*** FraudRecord Addon Module FOR WHMCS 5.x ***
*** Module Version 0.6.1
@joepie91
joepie91 / ip-binding-monkeypatch.py
Last active Dec 19, 2015
READ ALL OF THIS, IT'S IMPORTANT: This is how you monkeypatch support for binding to a specific IP into Python Requests. You use the new bound_ip keyword argument when creating a new session, to assign a certain IP to that Requests session. All subsequent HTTP requests made from that session via the standard methods, will be bound to that IP. No…
View ip-binding-monkeypatch.py
# I needed this for my nzbspider project (https://github.com/joepie91/nzbspider). Decided to throw up a stand-alone version.
import requests, socket
# Very nasty monkeypatching ahead!
socket.real_create_connection = socket.create_connection
class ModifiedSession(requests.Session):
def __init__(self, *args, **kwargs):
try:
View bot.py
#!/usr/bin/env python2
import socket, yaml, random, time
import cPickle as pickle
ctx = zmq.Context()
with open("config.yaml", "r") as cfile:
config = yaml.safe_load(cfile)
@joepie91
joepie91 / let-sink.py
Created Dec 17, 2013
All sunk threads on LowEndTalk
View let-sink.py
import requests, time
sess = requests.Session()
sess.headers.update({"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"})
base_uri = "http://lowendtalk.com"
# First page
json = sess.get("%s/discussions.json" % base_uri).json()
@joepie91
joepie91 / let-sink-offers.py
Created Dec 17, 2013
Sunken-ness of threads in the Offers category on LowEndTalk...
View let-sink-offers.py
import requests, time
sess = requests.Session()
sess.headers.update({"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1650.63 Safari/537.36"})
base_uri = "http://lowendtalk.com"
# First page
json = sess.get("%s/categories/offers.json" % base_uri).json()
@joepie91
joepie91 / usage.py
Created Jan 24, 2014
ZeroMQ Timer (for poller loop)
View usage.py
#!/usr/bin/env python2
import zmq, zmqtimer, sys, socket
ctx = zmq.Context()
poller = zmq.Poller()
def sample():
print "I am a sample function that runs every five and a half seconds!"
View converted.md
---
layout: post
title: "How to write proper PHP"
permalink: 2013/12/17/how-to-write-proper-php
postday: 2013/12/17
posttime: 05_57
tags: untagged
---
You can’t perform that action at this time.