Skip to content

Instantly share code, notes, and snippets.

View sonic74's full-sized avatar

Sven Killig sonic74

View GitHub Profile
@artms
artms / read.sh
Last active August 25, 2025 08:06
Reading from temper temperature sensor in bash only
#!/bin/bash
exec 5<> /dev/hidraw1
echo -e '\x00\x01\x80\x33\x01\x00\x00\x00\x00\c' >&5
OUT=$(dd count=1 bs=8 <&5 2>/dev/null | xxd -p)
HEX4=${OUT:4:4}
DVAL=$((16#$HEX4))
# handle negative temperatures
if [[ $DVAL -gt 32767 ]]; then
DVAL=$(($DVAL-65536))
fi
@jinnko
jinnko / patch-killer-firmware.zsh
Last active January 9, 2021 21:45
Automate patching Killer Wireless firmware on Ubuntu for Dell XPS 9370
#!/usr/bin/env zsh
#
# See the following AskUbuntu question for why this is a thing
# https://askubuntu.com/questions/1024281/dell-xps-13-9370-bluetooth-issues/1148484#1148484
#
# As the overwritten files are owned by the linux-firmware package you may want to add this
# script to an @reboot cron of the root user.
#
# This script uses the Windows driver package as the src of the firmware bin files. This can
# be acquired from https://www.dell.com/support/home/uk/en/ukbsdt1/drivers/driversdetails?driverId=1JVK3
@pklaus
pklaus / rigol-plot.py
Last active April 13, 2026 13:42 — forked from shirriff/rigol-plot.py
Example of controlling a Rigol oscilloscope via Python. Fetch a 1 MB "Long Memory" trace from the oscilloscope and graph it using matplotlib.
#!/usr/bin/env python
"""
Download data from a Rigol DS1052E oscilloscope and graph with matplotlib.
By Ken Shirriff, http://righto.com/rigol
Based on http://www.cibomahto.com/2010/04/controlling-a-rigol-oscilloscope-using-linux-and-python/
by Cibo Mahto.
"""
@pekkavaa
pekkavaa / jasc_convert.py
Created February 15, 2014 13:08
Converts JASC palette files to raw bytes.
#!/usr/bin/env python
import argparse
from struct import *
import re
def write_raw_palette(palette, output_path, write_header):
data = ""
header = pack('I', len(palette))
@XVilka
XVilka / TrueColour.md
Last active March 23, 2026 05:31
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@JonasGroeger
JonasGroeger / build.gradle
Last active December 8, 2024 11:45
Gradle: Read git commit hash.
def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 12
/*
* '.git/HEAD' contains either
* in case of detached head: the currently checked out commit hash
* otherwise: a reference to a file containing the current commit hash
*/
def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@klange
klange / image-to-ansi.py
Created January 27, 2012 06:29 — forked from MicahElliott/colortrans.py
Convert images to ANSI escape sequences
#! /usr/bin/env python
""" Convert an image (argv[1]) to an ANSI text string (xterm-256color)
Original readme from colortrans.py follows:
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources: