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 "os" | |
import "log" | |
import "io/ioutil" | |
import "github.com/szferi/gomdb" | |
func Set_Key(key, value string) int { | |
path, err := ioutil.TempDir("/tmp", "mdb_test") | |
if err != nil { |
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 sys | |
if __name__ == "__main__": | |
args = sys.argv[1:] | |
print(', '.join(args[0:3])) |
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 | |
# encoding: utf-8 | |
""" | |
client.py | |
Based heavily on: | |
- https://github.com/mtah/python-websocket/blob/master/examples/echo.py | |
- http://stackoverflow.com/a/7586302/316044 | |
Created by Drew Harry on 2011-11-28. |
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
// minimal example of a golang gorrilla websocket client | |
package main | |
import "github.com/gorilla/websocket" | |
import "net/http" | |
import "log" | |
import "os" | |
func main() { |
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
;Hello world in x86 assembly syntax (for nasm) | |
;to compile and run: | |
;$ yasm -f elf hello.asm 2>&1 | |
;$ ld -m elf_i386 -s -o hello *.o 2>&1 | |
section .text | |
global _start ;declared for linker | |
_start: ;linker entry point | |
mov edx,len ;message len | |
mov ecx,msg ;message to write |
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
# hello world in GAS syntax | |
# to compile and run | |
# $ yasm -f elf -p gas helloGAS.s 2>&1 | |
.text # section declaration | |
# we must export the entry point to the ELF linker or | |
.global _start # loader. They conventionally recognize _start as their | |
# entry point. Use ld -e foo to override the default. | |
_start: |
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
def GetSleepTime(self, resources): | |
'''Determines the minimum number of seconds that a program must wait | |
before hitting the server again without exceeding the rate_limit | |
imposed for the currently authenticated user. | |
Returns: | |
The minimum seconds that the api must have to sleep before query again | |
''' | |
if resources[0] == '/': | |
resources = resources[1:] |
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
# basic linear regression in pure python (no numpy!) | |
# class and function usable for streams | |
# refactored from http://code.activestate.com/recipes/578914-simple-linear-regression-with-pure-python/ | |
import math | |
def mean(series): | |
return sum(series) / len(series) | |
def standard_deviation(series, ave): |
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 pylab import * | |
from scipy.ndimage import measurements | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import time | |
import sys | |
import signal | |
def signal_handler(signal, frame): | |
sys.exit(0) |
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" | |
type OkCoin struct { | |
futures map[string]map[string]map[string]string | |
spot map[string]map[string]map[string]string | |
} | |
func OkCoinApi() OkCoin { |
OlderNewer