Skip to content

Instantly share code, notes, and snippets.

{
"version": "2.0.9",
"replacements": [
{
"active": true,
"case": "Maintain",
"repA": "woman",
"repB": "person",
"type": "Simple"
},
@wrenoud
wrenoud / formatWKT.ipynb
Last active September 10, 2015 18:37
Pretties a WKT string
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wrenoud
wrenoud / CracklePop.c
Last active September 10, 2015 02:31 — forked from anonymous/README.md
#include <iostream>
using namespace std;
void main()
{
for (int i = 1; i <= 100; i++)
{
bool divisible = false;
if (i % 3 == 0)
@wrenoud
wrenoud / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@wrenoud
wrenoud / clean_ember-cli.js
Last active May 3, 2018 08:03
Cleans uneed dependancy from Ember-CLI bower_componants folder
// based loosely on https://gist.github.com/dschmidt/a68747348036fd6aa989
// and the answer http://stackoverflow.com/questions/24782479/how-to-debug-slow-ember-cli-broccoli-builds/26044864#26044864
var glob = require('glob')
, fs = require('fs')
, util = require('util')
, _ = require('lodash');
EMBER_FILES=[
'ember/ember.js',
'ember/ember.prod.js',
@wrenoud
wrenoud / timehandler.py
Last active August 29, 2015 14:04
Convert different time formats to datetimes or timestamps (comes with tests)
import calendar
from datetime import datetime, timedelta, tzinfo
from math import floor
def seconds(day=0.0,hour=0.0,minute=0.0,second=0.0,microsecond=0.0):
return ((day*24.0 + hour)*60.0 + minute)*60.0 + second + microsecond/1000000.0
def minutes(day=0.0,hour=0.0,minute=0.0,second=0.0,microsecond=0.0):
return (day*24.0 + hour)*60.0 + minute + (second + microsecond/1000000.0)/60.0
@wrenoud
wrenoud / datagram_reader.py
Last active August 29, 2015 14:02
Buffered datagram reader
from collections import deque
import struct
import sys
import io
class datagram_reader:
"""Buffered datagram reader
Accepts any stream that supports read() method
"""
@wrenoud
wrenoud / hexdump.py
Last active August 29, 2015 14:01
Prints a formatted hexdump of a binary string
#!/usr/bin/python
"""CLI USAGE: hexdump [-w n] [-ws b] <filename>
-w --words the number of words to display on a line
-ws --word-size the number of bytes to display in a word
"""
import __future__
from StringIO import StringIO
import math
@wrenoud
wrenoud / enum_test.py
Created December 6, 2013 22:40
I was curious if there was any efficiency difference between using enumerate() and counting for myself. It appears that enumerate() might be slightly faster.
def enum_the_old_way():
i = 0
for j in myrange:
i += 1
def enum_the_new_way():
for i,j in enumerate(myrange):
pass
myrange = range(10000)
@wrenoud
wrenoud / countTo10.py
Last active December 25, 2015 18:59
Pointless recursion.
def countTo10_recursively(count = 0):
if(count <= 10):
countTo10_recursively(count + 1)
# which is the same as
def countTo10_theObviousWay():
for count in xrange(10):
pass
# lets do some tests