Skip to content

Instantly share code, notes, and snippets.

View sixtyfive's full-sized avatar
🐯
Rawrrr.

J. R. Schmid sixtyfive

🐯
Rawrrr.
View GitHub Profile
# ~/.ruby-lsp-gemset/.tool-versions
ruby 3.3.0
@sixtyfive
sixtyfive / README.md
Last active February 16, 2023 17:13
Some mods for the Pinebook Pro

What?

  • Changes the Power key to be Delete
  • Increases the display LED backlight PWM frequency to 10kHz
  • Overclocks the CPUs by 15-20%

How?

Please note that I'm running Manjaro. If you're going to be doing this under Debian, your paths will not have the /dtbs part in them as I'm told. You'll have to change things accordingly!

@sixtyfive
sixtyfive / update-ddns.rb
Last active January 18, 2025 00:42
DIY dDNS service script using Hetzner's DNS API
#!/usr/bin/env ruby
# on OpenRC systems, place into e.g. /etc/periodic/15min
# (or create /etc/periodic/1min and add line to root's crontab)
# on systemd systems, install it as a timer
# create/find these in Hetzner's DNS admin interface at https://dns.hetzner.com/
API_TOKEN_NAME="..."
API_TOKEN="..."
ZONES=["...", "..."] # TLD; must be registered at https://robot.hetzner.com/domain
require 'json'
file = File.read('./event.json')
event = JSON.parse(file)
keys = event['windows']['perfmon']['metrics']
hash=keys.map { |key, value|
key.split('_').reverse.reduce(value) {
|key_value, next_key| {
next_key => key_value
}
source 'https://rubygems.org'
gem 'docx'
@sixtyfive
sixtyfive / chars.rb
Last active September 15, 2021 13:31
Interpret bin/oct/dec/hex number(s) in specified character encoding and try to convert to UTF-8, then display the result if possible.
#!/usr/bin/env ruby
# -----------------------------------------------------------------------------
# chars: interpret bin/oct/dec/hex number(s) in specified character encoding
# and try to convert to UTF-8, then display the result if possible.
# (C) 2021 J. R. Schmid <[email protected]>
# May be shared and used according to CC BY-SA 4.0
# (https://creativecommons.org/licenses/by-sa/4.0/)
# -----------------------------------------------------------------------------
@sixtyfive
sixtyfive / gist-scad.sh
Last active August 11, 2021 21:02
Takes the path to an OpenSCAD .scad file as input and copies a GitHub Gist URL onto your Xorg clipboard as output. The Gist will contain the OpenSCAD source file as well as an in-browser rendering of the (ASCII) STL file. Works for me, but open to PRs, er, comments. Please share alike as you see fit.
#!/bin/bash
# Prerequisites: ###
# - OpenSCAD #
# - GitHUB CLI #
# - xclip #
# ################ #
[[ -z $1 || "${1: -5}" != ".scad" ]] && (echo "Usage: gist-scad <path to OpenSCAD .scad file>"; kill $$; exit 1)
@sixtyfive
sixtyfive / pyvipstest.py
Last active April 29, 2021 11:17
don't cache 1000 operations => don't leak RAM ... also cf. https://github.com/libvips/pyvips/issues/88
#!/usr/bin/env python3
import os.path
import pyvips
infilepath = '/path/to/file.pdf'
basename = os.path.basename(infilepath).split('.')[0]
infile = open(infilepath, 'rb').read()
pyvips.voperation.cache_set_max(10) # 0 = no parallelisation at all
@sixtyfive
sixtyfive / end-gcode
Created September 4, 2020 09:44
Ender 2 Start- and End-G-code for Cura
G91 ;Relative positioning
G1 E-60 ;Remove filament from hotend completely
G1 Z5 ;Hover over the print
G90 ;Absolute positioning
G1 X0 Y140 ;Present print
M106 S0 ;Turn off fan
M104 S0 ;Turn off hotend
M140 S0 ;Turn off bed
def colprint(aofas)
s=""; aofas.each{|i,c| s<<i; s<<(' '*(c-i.size+1)) if c>=i.size}; s
end