Skip to content

Instantly share code, notes, and snippets.

View synaptiko's full-sized avatar

Jiří Prokop synaptiko

View GitHub Profile
@synaptiko
synaptiko / 01-how-to-modify-physical-display-size-in-edid.md
Last active June 6, 2023 09:51
How to modify physical display size in EDID (on ArchLinux with systemd boot)

How to modify physical display size in EDID

Following method describes how to fix EDID display size information of your monitor if it's wrong (some of Samsung's monitors report incorrect size when connected over HDMI, for example). It assumes that your monitor is connected to HDMI1 port (HDMI-A-1 is full kernel address).

I used following tools:

@synaptiko
synaptiko / i3msg-jq.sh
Created August 30, 2016 17:33
Example how to use i3msg command
#!/usr/bin/env bash
isWorkspaceFocused=$(i3-msg -t get_workspaces | jq 'map(select(.focused==true))|map(.num)|map(select(. == 10))|length' 2> /dev/null)
isKicktermRunning=$(i3-msg -t get_tree | jq "recurse(.nodes[]) | .window_properties | objects | .class" | grep '"Kickterm"' | wc -l 2> /dev/null)
if [ $isKicktermRunning -eq 0 ]; then
/home/jprokop/Projects/kickterm/new-i3.py >& /dev/null
fi
if [ $isWorkspaceFocused -eq 0 ]; then
echo -e "\e[8;32mI'm hidden!\e[0m"
node
> console.log('\033[8;32mI'm hidden!\033[0m')
rust
println!("\x1B[8;32mI'm hidden!\x1B[0m");
// documentation here: http://ascii-table.com/ansi-escape-sequences.php
#picaxe 08m2
' Odkaz https://gist.github.com/synaptiko/10754510
' Tabulka názvů proměnných, které lze v 08M2 použít:
' b0:b1 b2:b3 b4:b5 b6:b7 b8:b9 b10:b11 b12:b13 b14:b15 b16:b17 b18:b19 b20:b21 b22:b23 b24:b25 b26:b27
' w0 w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13
' b* = 1 byte, tj. 256 různých hodnot
' w* = 2 byty, tj. 65 536 různých hodnot
' Kromě těchto dvou jde použít i bit* pro nastavení pouze 2 hodnot (true/false)
' Pozor bit0-bit7 se překrývá s b1. Stejně tak b1 a b2 se překrývá s w1. Analogicky je to i pro ostatní proměnné.
@synaptiko
synaptiko / screen-how-to.md
Last active December 20, 2015 19:58
Screen command manual excerpt

Příkazy:

Ctrl+a +

  • create – vytvoří nový terminál
  • previous – přepne na předchozí terminál
  • next – přepne na následující terminál
  • 09 – přepne na terminál dle pořadí od nuly
  • " – zobrazí seznam otevřených terminálů (se shiftem!)
  • renAme – přejmenování aktuální obrazovky
  • Split – rozdělí obrazovku
@synaptiko
synaptiko / index.html
Last active March 13, 2016 19:39
Servo PWM controller as Node.js service (requires kernel and modules from Adafruit's Occidentalis: http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2)
<!DOCTYPE html>
<html>
<head>
<style>
label {
display: inline-block; width: 100px; height: 20px; float: left; text-align: left;
}
input {
display: inline-block; width: 25%; height: 20px;
}
@synaptiko
synaptiko / index.html
Last active December 19, 2015 16:59
LED PWM with Python & Node.js
<!DOCTYPE html>
<html>
<head>
<style>
label {
display: inline-block; width: 20px; height: 20px; float: left; text-align: center;
}
input {
display: inline-block; width: 25%; height: 20px;
}
@synaptiko
synaptiko / tooHotLed.js
Created June 19, 2013 19:53
Simple program combining temperature sensor and led through GPIO.
#!/usr/bin/env node
var fs = require('fs');
var gpio = require("gpio");
var gpio10 = gpio.export(10, {
direction: "out",
ready: function() {
function readTemperature() {
var data = fs.readFileSync('/sys/bus/w1/devices/28-0000047c275a/w1_slave', { encoding: 'ascii' });
var temperature;
#!/bin/sh
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
@synaptiko
synaptiko / daemon.sh
Created June 9, 2013 19:33
Bash shell script which let run PROCESS_COMMAND forever until daemon is called with kill parameter.
#!/usr/bin/env bash
SCRIPT_PATH=$(readlink -f $0)
DIR=$(dirname $SCRIPT_PATH)
PID_DIR="${DIR}/pid"
LOG_DIR="${DIR}/log"
DAEMON_PID_FILE="${PID_DIR}/daemon.pid"
DAEMON_LOG_FILE="${LOG_DIR}/daemon.log"
PROCESS_PID_FILE="${PID_DIR}/process.pid"