Skip to content

Instantly share code, notes, and snippets.

View muety's full-sized avatar
🤓

Ferdinand Mütsch muety

🤓
View GitHub Profile
# Inspired by https://keon.io/deep-q-learning/
import random
import gym
import math
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
-- https://livebook.manning.com/book/postgis-in-action-second-edition/chapter-17/242
-- with a couple of bugs fixed
CREATE OR REPLACE FUNCTION get_rast_tile(
param_format text, -- e.g. 'image/png'
param_width integer, -- e.g. 256
param_height integer, -- e.g. 256
param_srid integer, -- e.g. 'EPSG:3857'
param_bbox text, -- e.g. '660415.9243839228,3713005.085980721,665307.8941941742,3717897.0557909757' in EPSG:3857
param_schema text,
@muety
muety / fetch.js
Created March 6, 2017 09:36
Get image as base64 string using node-fetch
'use strict';
const fetch = require('node-fetch')
, base64stream = require('base64-stream');
const URL = 'https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png';
fetch(URL)
.then((res) => {
return new Promise((resolve, reject) => {
@muety
muety / PGMap.php
Last active October 15, 2021 09:35
// https://livebook.manning.com/book/postgis-in-action-second-edition/chapter-17/242
// https://gist.github.com/muety/9e3a6d0ad2bb5890c081670e0c4fc044
<?php
define("DSN", "host=localhost dbname=postgis_in_action user=postgis_in_action port=5432 password=whatever");
$param_format = $_REQUEST['FORMAT'];
$param_width = (int) $_REQUEST['WIDTH'];
$param_height = (int) $_REQUEST['HEIGHT'];
$param_bbox = $_REQUEST['BBOX'];
$param_schema = $_REQUEST['SCHEMA'];
@muety
muety / whatsapp_to_telegram.py
Last active September 16, 2021 13:27
A script to help you migrate your whole WhatsApp chat history with a person to Telegram
#!/bin/python
import os
import re
import shutil
# A script to help you migrate your whole WhatsApp chat history with a person to Telegram
# Instructions
# 1. Install "Backup WhatsApp Chats" extenstion to Chrome
@muety
muety / localssh.sh
Created December 3, 2020 13:33
Reverse tunneling to localhost using SSH (ngrok alternative)
#!/bin/bash
# Requires 'GatewayPorts clientspecified' to be set in /etc/ssh/sshd_config
HOST="muetsch.io"
REMOTE_PORT="8080"
REMOTE_BIND_V4="127.0.0.1"
PROXY_URL="https://local.muetsch.io"
echo -e "----------- localssh -----------"
# Inspired by https://medium.com/@tuzzer/cart-pole-balancing-with-q-learning-b54c6068d947
import gym
import numpy as np
import math
from collections import deque
class QCartPoleSolver():
def __init__(self, buckets=(1, 1, 6, 12,), n_episodes=1000, n_win_ticks=195, min_alpha=0.1, min_epsilon=0.1, gamma=1.0, ada_divisor=25, max_env_steps=None, quiet=False, monitor=False):
self.buckets = buckets # down-scaling feature space to discrete range

Keybase proof

I hereby claim:

  • I am muety on github.
  • I am n1try (https://keybase.io/n1try) on keybase.
  • I have a public key ASBHcQlgHHRLDR82SZGORIcw-TKTcUkburZy7YZAiE9DcQo

To claim this, I am signing this object:

@muety
muety / deezer2json.js
Last active November 29, 2019 19:55
Export Deezer playlist to JSON
/*
1. Go to Deezer.com and open the playlist you want to export, e.g. https://www.deezer.com/en/profile/850026602/loved
2. Scroll down to the very bottom
3. Open your browser's dev tools (F12 on Linux an Windows) and go to the Console tab
4. Paste the following one-line command and hit enter
*/
JSON.stringify(Array.prototype.slice.call(document.getElementsByClassName('datagrid-row song')).map(r => Object.assign({}, {title: r.getElementsByClassName('title')[0].childNodes[0].textContent, artist: Array.prototype.slice.call(r.querySelectorAll('[itemprop="byArtist"]')).map(a => a.textContent).reduce((acc, a) => a + ', ' + acc, '').slice(0, -2)})), null, 2)
@muety
muety / vpn.md
Created November 17, 2018 06:32
Use FritzBox IPSec VPN on Ubuntu 18.04

FritzBox VPN on Ubuntu 18.04

  • Configure VPN for a user on your FritzBox and don't forget to show the pop-up including your credentials etc. afterwards. Also make sure you check "Allow access from internet".
  • sudo apt install vpnc network-manager-vpnc
  • Create file /etc/vpnc/vpn.conf, paste the following content and insert your credentials etc.
IPSec gateway yourfritzboxhere.myfritz.net
IPSec ID your_user
IPSec secret your_preshared_key