This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashSet; | |
import java.util.Set; | |
public class PowerSet { | |
private Set<Set<Object>> powerSet; | |
private void setCombinations(Set<Object> set) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
base = datetime.datetime.today() | |
dateList = [ base - datetime.timedelta(minutes=2*x) for x in range(0,48) ] | |
hour_ago = base - datetime.timedelta(hours=1) | |
# get the number of dates from less than an hour ago | |
len(filter(lambda x: x > hour_ago, dateList)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!d3.chart) d3.chart = {}; | |
d3.chart.brush = function() { | |
var g; | |
var data; | |
var width = 600; | |
var height = 30; | |
var dispatch = d3.dispatch(chart, "filter"); | |
function chart(container) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx - logrotate & upload to S3 | |
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx | |
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digits2alpha = {'1':('1'), | |
'2':('a','b','c'), | |
'3':('d','e','f'), | |
'4':('g','h','i'), | |
'5':('j','k','l'), | |
'6':('m','n','o'), | |
'7':('p','q','r','s'), | |
'8':('t','u','v'), | |
'9':('w','x','y','z'), | |
'0':('0')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from luigi.format import Format | |
import csvkit | |
class CSVOutputProcessor(object): | |
""" | |
A simple CSV output processor to be hooked into Format's | |
`pipe_writer`. | |
If `cols` are given, the names are used as CSV header, otherwise no | |
explicit header is written. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
# PyCryptodome, NOT pycrypto | |
from Crypto.Cipher import AES | |
from Crypto.Protocol.KDF import PBKDF2 | |
class AesCrypt256: | |
#Based on https://gist.github.com/pfote/5099161 | |
BLOCK_SIZE = 16 | |
def pkcs5_pad(self,s): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AesCrypt256: | |
#Based on https://gist.github.com/pfote/5099161 | |
BLOCK_SIZE = 16 | |
# To use the null/x00 byte array for the IV | |
default_initialization_vector = False | |
def __init__(self, default_initialization_vector=False): | |
self.default_initialization_vector = default_initialization_vector | |
OlderNewer