This file contains 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 hashlib import md5 | |
from bisect import bisect | |
class Ring(object): | |
def __init__(self, server_list, num_replicas=3): | |
nodes = self.generate_nodes(server_list, num_replicas) | |
hnodes = [self.hash(node) for node in nodes] | |
hnodes.sort() |
This file contains 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
#!/bin/bash | |
# | |
# supervisord This scripts turns supervisord on | |
# | |
# Author: Mike McGrath <[email protected]> (based off yumupdatesd) | |
# Jason Koppe <[email protected]> adjusted to read sysconfig, | |
# use supervisord tools to start/stop, conditionally wait | |
# for child processes to shutdown, and startup later | |
# Mikhail Mingalev <[email protected]> Merged | |
# redhat-init-jkoppe and redhat-sysconfig-jkoppe, and |
This file contains 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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
) | |
var ( | |
INTERVAL_SEC = 10 |
This file contains 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 unittest | |
import mock | |
class Trainer(object): | |
@property | |
def column_names(self): | |
return ["one", "two"] |
This file contains 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
package main | |
import ( | |
"log" | |
"math" | |
"runtime" | |
"time" | |
as "github.com/aerospike/aerospike-client-go" | |
) |
This file contains 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
// Playbook - http://play.golang.org/p/3wFl4lacjX | |
package main | |
import ( | |
"bytes" | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" |
This file contains 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 base64 import urlsafe_b64encode, urlsafe_b64decode | |
from Crypto.Cipher import AES | |
from Crypto import Random | |
BS = 16 | |
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) | |
unpad = lambda s: s[:-ord(s[len(s) - 1:])] | |
base64pad = lambda s: s + '=' * (4 - len(s) % 4) |
This file contains 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
TIMEZONE_CHOICES = ( | |
('US/Hawaii', '(UTC-1000) Hawaii time'), | |
('America/Atka', '(UTC-0900) Alaska time'), | |
('Pacific/Pitcairn', '(UTC-0800) Pitcairn time'), | |
('America/Dawson', '(UTC-0700) Dawson time'), | |
('America/Dawson_Creek', '(UTC-0700) Dawson Creek time'), | |
('America/Hermosillo', '(UTC-0700) Hermosillo time'), | |
('America/Los_Angeles', '(UTC-0700) Los Angeles time'), | |
('America/Vancouver', '(UTC-0700) Vancouver time'), | |
('America/Phoenix', '(UTC-0700) Phoenix time'), |
This file contains 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
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"net/http" | |
) | |
func readCSVFromUrl(url string) ([][]string, error) { | |
resp, err := http.Get(url) |
This file contains 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
#!/usr/bin/env python | |
"""A simple python script template. | |
""" | |
import os | |
import sys | |
import argparse |
NewerOlder