Skip to content

Instantly share code, notes, and snippets.

@lalten
lalten / README.md
Last active December 26, 2022 22:53 — forked from thomasleveil/README.md
Workaround for oled backlight issues

Works for Thinkpad X1 Yoga 2G (20JDCTO1WW) (and most probably others) with OLED display

First install inotify-tools. Then create a script around inotify that will be launched upon each boot or through autostart.

sudo apt install inotify-tools
cat <<-EO1 | sudo tee /usr/local/bin/xbacklightmon.sh#!/bin/bash
    # https://wiki.archlinux.org/index.php/backlight#sysfs_modified_but_no_brightness_change
    # https://wiki.archlinux.org/index.php/Alienware_13#OLED_screen_brightness
    # https://gist.github.com/lalten/ce5ac0b1cc4b24a24cc44926255b871d

apt install inotify-tools

@lalten
lalten / reset_arduino.py
Created April 17, 2017 21:03
Reset Arduino Micro via python serial
#!/usr/bin/env python
import serial
port='/dev/ttyACM0' #adjust this in case your device differs
ser = serial.Serial() #open serial connection
ser.port=port #setting the port accordingly
#in case your usual baudrate isn't 9600 reset will not work, therefore we will open a resetable connection
#thanks to mattvenn.net for suggesting to add this step!
ser.baudrate=9600
@lalten
lalten / modify.sh
Created January 29, 2022 21:54
Modify Cura printer settings to use a custom platform mesh.
#!/bin/bash
set -eux
## Setup
# Modification settings
OldPrinterModelName="Creality CR-6 SE"
NewPrinterModelName="MyPrinter"
# Cura paths
@lalten
lalten / install_hterm.sh
Created November 28, 2017 09:01
Install hterm on recent 64-bit Ubuntu
#!/bin/bash
# get hterm
wget http://www.der-hammer.info/terminal/hterm.tar.gz
tar xvfz hterm.tar.gz
# get libpng12
wget http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_i386.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1_*
@lalten
lalten / us
Created November 19, 2018 10:08
Make CapsLock+A print Ä, et. al. : `/usr/share/X11/xkb/symbols/us`
default partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "English (US)";
key <TLDE> { [ grave, asciitilde ] };
key <AE01> { [ 1, exclam ] };
key <AE02> { [ 2, at ] };
key <AE03> { [ 3, numbersign ] };
key <AE04> { [ 4, dollar ] };
This file has been truncated, but you can view the full file.
Ball[] myBall;
int ballAmount = 100;
int distance = 100;
float distBalls, lineWeight, fr;
int d = 2; // Diameter.
boolean toggleLoop = true;
void setup() {
size(720, 720);
background(255);
@lalten
lalten / sr_fsm.py
Last active November 6, 2015 22:23
Example on how to use finites state machines on a Student Robotics robot.
# -*- coding: utf-8 -*-
# Solution for Munich kickstart tasks 2015
# Introduces the vision system, servo control and a finate state machine
# ----------------------------------------------------------------------
#
# Loest die Aufgaben, die in den Zeilen stehen, die mit #TASK# beginnen.
# ----------------------------------------------------------------------
# import SR libraries