Skip to content

Instantly share code, notes, and snippets.

@dylanroy
dylanroy / minimum.html
Created February 5, 2014 19:24
Base Html Templates
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="" rel="stylesheet" />
<style></style>
</head>
<body>
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
import random
NUMBER_OF_PLAYERS = 5
NUMBER_OF_ITERATIONS = 1000000
def main():
if NUMBER_OF_PLAYERS < 2:
raise ValueError("Must have at least 2 people.")
if NUMBER_OF_ITERATIONS < 1:
@dylanroy
dylanroy / tweet_dumper.py
Last active August 29, 2015 14:23 — forked from yanofsky/LICENSE
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@dylanroy
dylanroy / mandelbrot.sql
Last active August 29, 2015 14:25 — forked from rupey/mandelbrot.sql
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@dylanroy
dylanroy / dnn-upload-1.xml
Created August 9, 2012 21:03
First web.config reference
<requestFiltering>
<requestLimits maxAllowedContentLength="[bytes]" />
</requestFiltering>
@dylanroy
dylanroy / dnn-upload-2.xml
Created August 9, 2012 21:04
Second web.config reference
<httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="[kilobytes]" requestLengthDiskThreshold="8192" executionTimeout="1200" />
@dylanroy
dylanroy / dnn-upload-3.xml
Created August 9, 2012 21:05
ConfigDefault.xml reference
<property name="DocumentManager.SearchPatterns">[File Extensions]</property>
<property name="DocumentManager.MaxUploadFileSize">[bytes]</property>
@dylanroy
dylanroy / pictures.markdown
Created August 29, 2012 17:19 — forked from sent-hil/pictures.markdown
River (getriver.com): Keep a programming journal.

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature
@dylanroy
dylanroy / password_hashing_api.md
Created September 12, 2012 18:58 — forked from nikic/password_hashing_api.md
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.