Skip to content

Instantly share code, notes, and snippets.

View tsbertalan's full-sized avatar

Tom Bertalan tsbertalan

  • University of Massachusetts Lowell
  • United States
View GitHub Profile
#!/usr/bin/env python3
import tkinter as tk
from sys import platform
# Draw a circle around the pointer. Use tkinter to make circle without window.
root = tk.Tk()
#root.config(bg='')
#root.overrideredirect(True)
"""
Change the scrolling direction of a USB mouse.
"""
# Request UAC:
# https://newbedev.com/request-uac-elevation-from-within-a-python-script
import ctypes, sys
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
@tsbertalan
tsbertalan / .gitattributes
Last active June 10, 2020 17:23
connect_package_lixiaojian
*.7z filter=lfs diff=lfs merge=lfs -text
@tsbertalan
tsbertalan / create_firefox_app.py
Last active March 4, 2024 14:35
Largely automate the process of making a special-purpose Firefox profile without window chrome.
#!/usr/bin/env python
from __future__ import print_function
import argparse
from os import system
from glob import glob
from os.path import join, expanduser
HOME = expanduser('~')
@tsbertalan
tsbertalan / custom_gradient_polynomial.py
Last active August 26, 2021 17:38
Demonstrate tensorflow's `custom_gradient` for a polynomial op.
import tensorflow as tf, numpy as np, matplotlib.pyplot as plt
trainable = []
order = 4
@tf.custom_gradient
def poly(x):
# Create the (or get a handle to the existing existing) polynomial coefficients variable
# that we're supposed to learn.
#!/bin/bash
set -e
export IFS='
'
rm /tmp/snaps_to_remove
touch /tmp/snaps_to_remove
echo "#Listing mounts ..."
for f in $(df | awk "{ print \$6 }" | grep snap)
@tsbertalan
tsbertalan / Streaming Bokeh Plot.ipynb
Last active January 6, 2021 04:04
Update a loss history plot live in a Jupyter notebook.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tsbertalan
tsbertalan / .gitconfig
Created October 26, 2018 18:04
Partial global gitconfig
[color]
ui = auto
[alias]
changes = diff --name-status -r
tree = log --oneline --decorate --graph --all
unadd = reset HEAD
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !git lg1
todo = grep -n -e TODO -e FIXME -e XXX -e OPTIMIZE
@tsbertalan
tsbertalan / matomat.out
Last active September 14, 2018 19:39
Matrix-of-matrices class implementing a recursive matrix-multiplication.
MatOMat([[array([[ 0.05056171, 0.49995133],
[-0.99590893, 0.69359851]]),
array([[-0.41830152, -1.58457724],
[-0.64770677, 0.59857517]])],
[array([[ 0.33225003, -1.14747663],
[ 0.61866969, -0.08798693]]),
array([[ 0.4250724 , 0.33225315],
[-1.15681626, 0.35099715]])],
[array([[-0.60688728, 1.54697933],
[ 0.72334161, 0.04613557]]),

Keybase proof

I hereby claim:

  • I am tsbertalan on github.
  • I am tsbertalan (https://keybase.io/tsbertalan) on keybase.
  • I have a public key ASBdX7B7HKtofMVBJGwuheDtGWcaYQ9zdeFwJjJRWSRbUwo

To claim this, I am signing this object: