Skip to content

Instantly share code, notes, and snippets.

View ei-grad's full-sized avatar

Andrew Grigorev ei-grad

View GitHub Profile
@Slach
Slach / flask_pynba_monitoring.py
Last active January 20, 2017 06:14
Flask + Pynba monitoring example
import pynba
import pynba.util
import flask
import logging
import datetime
# see https://gist.github.com/Slach/00c86b1341f738bc9dd5
from monitor import CoffeePynbaMonitor
logger = logging.getLogger('pynba')
#!/usr/local/bin/python
"""
Q-learning - off policy TD(0) learning.
Q(S, A) <- Q(S, A) + alpha * ((R + gamma * max(Q(S', A'))) - Q(S, A))
A ~ e-greedy from pi(A|S)
"""
import argparse
import numpy as np
@icyblade
icyblade / frozenlake-v0.py
Created January 9, 2017 08:00
Solution of FrozenLake-v0 using Q table
#! coding: utf8
import os
import gym
import numpy as np
from gym import wrappers
env = gym.make('FrozenLake-v0')
os.system('rm -rf /tmp/frozenlake_v0_q_table')
env = wrappers.Monitor(env, '/tmp/frozenlake_v0_q_table')
@ei-grad
ei-grad / haproxy.cfg
Last active April 3, 2018 08:29
Trivial haproxy config for tcp port forwarding
listen l1
bind 0.0.0.0:80
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 192.168.1.1:80
global
user "nobody"
@ei-grad
ei-grad / trinkup
Last active August 5, 2018 23:26
TRivial INcremental bacKUP script (MOVED TO REPOSITORY)
#!/bin/bash
#
# trinkup - TRivial INcremental bacKUP script
#
# Уж 200 раз твердили Сене:
# Хардлинк спасет от удаленья!
# А кто создать его поможет?
# Crontab и man, тупая рожа!
#
# (c) linux.org.ru, no-dashi
# -*- coding: utf-8 -*-
import re
def transliterate(string):
capital_letters = {u'А': u'A',
u'Б': u'B',
u'В': u'V',
u'Г': u'G',
@e000
e000 / donotuse.py
Created June 13, 2011 23:30
How to NEVER use lambdas.
##########################################################
# How to NEVER use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda constru-#
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] #
# by: e000 (13/6/11) #
##########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much anonymous "one line" functions
@rumly111
rumly111 / tsd.py
Created July 20, 2019 14:30
transmission sequential download
#!/usr/bin/python3
# Monitor transmission and enable sequential downloads
# by manipulating file download priorities
#
# Author: Joseph Botosh <rumly111@gmail.com>
# License: GPL
from time import sleep
from argparse import ArgumentParser
@mattjohnsonpint
mattjohnsonpint / Program.cs
Last active September 6, 2022 17:15
Airport Time Zones
using System.Text.RegularExpressions;
using GeoTimeZone; // Import from Nuget package "GeoTimeZone" (https://github.com/mattjohnsonpint/GeoTimeZone)
using TimeZoneConverter; // Import from Nuget package "TimeZoneConverter" (https://github.com/mattjohnsonpint/TimeZoneConverter)
namespace AirportTimeZones;
internal static class Program
{
private static void Main()
{
@passos
passos / Dumper.py
Last active March 24, 2023 02:55
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
Copyright 2011 Jinyu LIU
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.