Skip to content

Instantly share code, notes, and snippets.

View Sulverus's full-sized avatar

Andrey Drozdov Sulverus

View GitHub Profile
@Sulverus
Sulverus / msgpack.cc
Created July 8, 2015 16:16
msgpack debug print
/**
* MP_EXT is printed as "EXT" only, all MP_EXT data is skipped
*/
static int
mp_print_internal(const char **beg)
{
switch (mp_typeof(**beg)) {
case MP_NIL:
mp_next(beg);
printf("NIL");
##
## General
##
# Set correct TERM
set-option -g history-limit 10000
set -g default-terminal "screen-256color"
# Start non-login shell
#set -g default-command "${SHELL}"
@Sulverus
Sulverus / travis.py
Last active August 29, 2015 14:16
Travis pusher
# Travis rebuild pusher
# requires: travispy
# Also you need to have github api token
from travispy import TravisPy
github_token = '[Your github token]'
def travis_auth(token):
return TravisPy.github_auth(token)
@Sulverus
Sulverus / prime_poly.py
Last active August 29, 2015 14:05
Prime Palindrome
"""
Code golf. Find first prime palindrome
115 chars=)
"""
def golf(n):
p=lambda s:s==s[::-1]
while True:
n+=1
if all([n%i for i in xrange(2,n)]) and p(str(n)):return n
@Sulverus
Sulverus / checker.py
Created September 13, 2013 07:21
Simple http availability checker class =)
import requests
from datetime import datetime
HTTP_SUCCESS = 200
AGENT = 'CheckPy/0.0.1'
class HttpChecker():
"""
Simple http checker:
@Sulverus
Sulverus / 40str_server.py
Last active December 17, 2015 18:29
small http server fork. with request split and user-agent output=)
from socket import *
LOG_MODE = True
DEFAULT_REPLY = '<h1>Hello world fork=)</h1>'
MAX_RECV = 1024
def server_bind(port, max_conn):
s = socket(AF_INET, SOCK_STREAM)
s.bind(('', port))
s.listen(max_conn)