Skip to content

Instantly share code, notes, and snippets.

View imabuddha's full-sized avatar
👨‍💻
Looking for work

John Mifsud imabuddha

👨‍💻
Looking for work
View GitHub Profile
From a post by John Fairbairn on GoDiscussions.com:
For most practical purposes the necessary information can be reduced to an algorithm which I think goes back to a paper by Karl-Heinz Lenz in the Deutsche Go-Zeiting in the early 80s. My version of it (at your own peril) is:
1. Choose Attacker (= player with advantage; side with bigger eye or, if equal side with more exclusive liberties) and defender; small eyes count as equal irrespective of size)
2. Get number of Shared liberties S
3. From S, get Fail number F
on adding folder items to this_folder after receiving added_items
tell application "Safari"
repeat with w in windows
if name of w is "Downloads" then
set isdocument to true
try
set d to document of w
set the result to d
on error
set isdocument to false
@imabuddha
imabuddha / Get pro go games
Created January 28, 2010 04:47
get new go games & rename files
#!/bin/bash
# great src url: http://igo-kisen.hp.infoseek.co.jp/topics.html
SGF_SRC_LISTUsers/adrian/Go/Games/TWIG/urls.txt
SCRATCH_DIRtmp/twig
DESTINATION_DIRUsers/adrian/Go/Games/TWIG
mkdir $SCRATCH_DIR
cd $SCRATCH_DIR
@imabuddha
imabuddha / Bind mouse middle button to BACK — [Raspberry Pi]
Last active December 10, 2020 13:41
Put in .xbindkeysrc (common suggestions using xte didn't work for Chromium on Raspberry Pi OS)
# make sure to: sudo apt-get install xvkbd
# map mouse middle button to BACK in browsers, etc.
"/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[Left]""
m:0x0 + b:2
@imabuddha
imabuddha / .lightdm-cleanup.sh
Last active December 17, 2020 04:19
Make sure certain processes are terminated on logout — [Raspberry Pi] Requires two script files: one for the user & one for lightdm. This is because it should only kill when the user's session actually ends (not lock screen, etc.).
#! /bin/bash
# This script is for Raspberry pi os (current as of 16 Dec 2020)
# Location for this script: ~/.lightdm-cleanup.sh
#
# Make sure the following user processes are terminated on logout.
# If not terminated cleanly then their services won't operate
# properly when user logs in again (without rebooting).
#
# shairport-sync: with pulseaudio backend can't run shairport-sync as service
# touchegg: gestures won't work after logout/login unless client is killed on logout
@imabuddha
imabuddha / shairpoint-sync-autostart — [Raspberry Pi]
Last active December 7, 2020 11:30
Run shairport-sync on login [create new file shairpoint-sync-autostart in /home/pi/.config/autostart]
[Desktop Entry]
Type=Application
Name=Shairport-sync autostart
Comment=must be run after login because of pulseaudio
NoDisplay=true
Exec=/usr/local/bin/shairport-sync
@imabuddha
imabuddha / stress — [Raspberry Pi]
Last active December 6, 2020 17:58
Short cpu stress & temp based on script used by https://www.youtube.com/c/explainingcomputers
#!/bin/bash
clear
for f in {1..7}
do
vcgencmd measure_temp
sysbench --test=cpu --cpu-max-prime=25000 --num-threads=4 run >/dev/null 2>&1
done
vcgencmd measure_temp
@imabuddha
imabuddha / long-stress — [Raspberry Pi]
Created December 6, 2020 17:59
Full day cpu & gpu stress test
#!/bin/bash
clear
glxgears &
echo running a full day, ctrl+c to quit
stress-ng --cpu 0 --cpu-method fft
@imabuddha
imabuddha / Change caps-lock key to control — [Raspberry Pi]
Created December 6, 2020 18:04
Add this line to /etc/xdg/lxsession/LXDE-pi/autostart
@setxkbmap -option ctrl:nocaps
Setting up the Compose key: In cmd line version of raspi-config, go to the configure_keyboard section.
See https://help.ubuntu.com/community/GtkComposeTable for how to use it.
Favs:
.= ⇒ •
.. ⇒ …
y= ⇒ ¥
--- ⇒ — (em)
--. ⇒ – (en)
-> ⇒ →