Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Thomas Andreas Hesse tahesse

🎯
Focusing
View GitHub Profile
@tahesse
tahesse / toggletouchpad
Created Feb 21, 2021
Bash script to toggle touchpad state on X server
View toggletouchpad
#!/bin/bash
# set your device name here (can be found through `xinput`)
touchpadDevice='SynPS/2 Synaptics TouchPad'
if [ ! -z "$1" ]; then
# set the device state via argument (must be 0 or 1)
devEnabled=$1
else
# toggle the device state
@tahesse
tahesse / main.dart
Created Feb 6, 2021
How to check if Dart List contains certain object instance?
View main.dart
class Book {
String title;
Book(this.title);
}
void main() {
List<Book> bookList = [
Book('foo'),
];
@tahesse
tahesse / type_enforcement.py
Created Mar 13, 2018
Python 3.6 type «enforcement» (/ check) through annotations or custom list of types
View type_enforcement.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging.config
import functools
from typing import Callable, Union
__author__ = 'Thomas Hesse'
@tahesse
tahesse / hidraw_read.py
Created Mar 11, 2018
Debug hidraw through hipdapi in linux python 3.6
View hidraw_read.py
#!/usr/bin/env python
"""Debug hidapi python library and hid devices.
You may use this utility script for debugging purposes to check if this library does work as
intended, thus detecting all plugged hid devices.
This files does also provide you with the vendor_id and product_id required by the udev rule.
"""
@tahesse
tahesse / masternode_kill_processes.sh
Created Jun 23, 2017
Shell script to terminate all services started by DC/OS that run on the master node. Source: https://dcos.io/docs/1.9/installing/ports/
View masternode_kill_processes.sh
#!/usr/bin/bash
killall nginx 2>/dev/null && echo "Killing nginx service on ports 80, 443"
for port in {53,1050,1801,2181,5050,7070,8080,8123,8181,9990,15055,15101,15201}; do
kill -9 $(netstat -tlnp | awk "/:$port */ {split(\$NF,a,\"/\"); print a[1]}") 2>/dev/null && echo "Killing service that runs on port $port"
done