Skip to content

Instantly share code, notes, and snippets.

@tyrion
tyrion / twitter.py
Created June 17, 2015 12:36
Simple Interface to Twitter APIs
import json
import logging
import os
import traceback
from contextlib import closing
import requests
from requests_oauthlib import OAuth1
INFO:trl.experiment: Initialized env <CarOnHill instance>
INFO:trl.experiment: observation space: Box(2,)
INFO:trl.experiment: action space: DiscreteValued(<built-in method tolist of numpy.ndarray object at 0x7faacc7818a0>)
INFO:trl.experiment: Random seeds (np, env): 2696744048250742569 None
INFO:trl.experiment: Discretized actions (2): [-4. 4.]
INFO:trl.experiment: Gamma: 0.950000
INFO:trl.experiment: Loading dataset from car.h5
INFO:trl.experiment: Collected 61443 samples
Using TensorFlow backend.
INFO:trl.regressor: Loaded regressor from car.h5
@tyrion
tyrion / tiles.py
Last active February 18, 2018 09:38
Tile Coding Software
# tiles.py -- Tile Coding Software
# Copyright (C) <2018> <Germano Gabbianelli>
#
# Based on Tiles3 by Richard S. Sutton:
# http://incompleteideas.net/tiles/tiles3.html
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@tyrion
tyrion / poetry_bug.py
Last active May 20, 2019 14:40
Poetry Bug
def hello():
print("hello poetry")
@tyrion
tyrion / pgauth.sql
Created June 30, 2019 10:55
DB level authentication with PostgreSQL
RESET SESSION AUTHORIZATION;
DROP OWNED BY webuser, login, user1;
DROP ROLE IF EXISTS webuser, login, user1;
CREATE ROLE login LOGIN NOINHERIT;
CREATE ROLE webuser NOINHERIT;
DROP SCHEMA IF EXISTS auth CASCADE;
CREATE SCHEMA auth;
SET search_path TO auth;
let
nixpkgs = import <nixpkgs> {};
pkgs = with nixpkgs; rec {
patched-ffmpeg = callPackage ./patched-ffmpeg.nix { };
jabref = callPackage ./jabref.nix { ffmpeg_2 = patched-ffmpeg; };
};
in pkgs
{ stdenv, fetchFromGitHub, coreutils, ocamlPackages, zlib, pcre, neko, mbedtls
, ocaml-sha # put this into ocamlPackages
}:
stdenv.mkDerivation rec {
pname = "haxe";
version = "4.1.5";
src = fetchFromGitHub {