Skip to content

Instantly share code, notes, and snippets.

View zimmerrol's full-sized avatar

Roland Zimmermann zimmerrol

View GitHub Profile
@zimmerrol
zimmerrol / instructions
Last active April 29, 2020 07:31
How to use ssh authentication for git on Windows 10
1. Add ssh key to shh config:
Host github.com
IdentityFile C:\Users\XXX\.ssh\github_id_rsa
2. Auto-start OpenSSH Authentication Agent (via PowerShell as admin)
Set-Service ssh-agent -StartupType Automatic
3. Make git use Window's OpenSSH installation and not its own:
def ihvp(f, w, v, n, alpha):
# calculate the inverse hessian vector product
# cast to list (this is important if w is a generator)
w = list(w)
p = tuple(list(v).copy())
for j in range(n):
grads = torch.autograd.grad(f, w, grad_outputs=v, retain_graph=True)
@zimmerrol
zimmerrol / void_printer.py
Last active May 14, 2019 12:21
Disable print function temporarily
import builtins as __builtin__
import sys
import io
class VoidPrinter:
def __init__(self):
pass
def __enter__(self):
self._stdout_bkp = sys.stdout
parent = ['heute', 'sitze', 'ich', 'hier', 'und', 'morgen', 'sitze', 'ich', 'auch', 'dort']
child = ['sitze', 'ich', 'auch']
def search(parent, child):
found = False
for i in range(len(parent)):
if parent[i] == child[0]:
found = True
for j, word in enumerate(child):
if word != parent[i+j]:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:SMSIP2.ViewModels;"
xmlns:conv="clr-namespace:SMSIP2.Converters"
x:Class="SMSIP2.CourseListPage"
Title="{Binding Title}"
xmlns:helpers="clr-namespace:SMSIP2.Core.Helpers;assembly=SMSIP2.Core"
x:Name="BrowseItemsPage">
@zimmerrol
zimmerrol / lautze.py
Created January 23, 2018 14:13
lautze.py
lst = [(123, 456, 789), (123, 465, 789), (125, 456, 734)]
import numpy as np
#get unique IDs
fstuniq = np.unique([x[0] for x in lst])
snduniq = np.unique([x[1] for x in lst])
trduniq = np.unique([x[2] for x in lst])
print(fstuniq)
print(snduniq)
@zimmerrol
zimmerrol / gist:75e751fa308ed529315f58bc7fb4e864
Created October 17, 2017 08:36
CuPy - installation log
C:\Users\*>pip install cupy --no-cache-dir -vvvv
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Collecting cupy
1 location(s) to search for versions of cupy:
* https://pypi.python.org/simple/cupy/
Getting page https://pypi.python.org/simple/cupy/
Starting new HTTPS connection (1): pypi.python.org
"GET /simple/cupy/ HTTP/1.1" 200 930
Analyzing links from page https://pypi.python.org/simple/cupy/
C:\Users\Roland\Desktop\tmp\gym>conda install pachi-py
Fetching package metadata ...........
PackageNotFoundError: Package missing in current win-64 channels:
- pachi-py
C:\Users\Roland\Desktop\tmp\gym>
C:\Users\Roland\Desktop\tmp\gym>
C:\Users\Roland\Desktop\tmp\gym>
@zimmerrol
zimmerrol / sarsa.py
Created July 29, 2017 15:17
Episodic Semi-gradient Sarsa for Estimating q using NN with Keras
#improves the output of keras on Windows
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
import logging
logging.getLogger("tensorflow").setLevel(logging.WARNING)
import numpy as np
import keras as K