Skip to content

Instantly share code, notes, and snippets.

View ei-grad's full-sized avatar

Andrew Grigorev ei-grad

View GitHub Profile
@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
#!/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')

Recovering deleted files in Ubuntu with ext4 filesystem

Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. These notes document the steps I took to get them back.

Important

  • this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir). The procedure needs that the partition that contained the files is unmounted, so if the deleted files were in the root partition, the process would be a bit different (e.g. storing the fs journal in a USB stick, using a live CD/USB to boot and issue the commands, etc.)
  • if something is not clear, you need more information, etc. check the sources below

With that out the way, let's begin.

@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')
@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()
{
@denji
denji / golang-tls.md
Last active March 29, 2024 03:03 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@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
@willurd
willurd / web-servers.md
Last active April 23, 2024 23:07
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000