Skip to content

Instantly share code, notes, and snippets.

A UDP packet bar walks a into...

Attila Györffy attilagyorffy

A UDP packet bar walks a into...
View GitHub Profile
View the % notation in

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.


% or %Q

attilagyorffy / bigsur_release_availability.rb
Created Nov 12, 2020
Excited about the imminent availability of Big Sur but tired of checking the software update pane in System Preferences? Use this Ruby script to automate it and get a notification once it's available in your region.
View bigsur_release_availability.rb
# NOTE: This script assumes that you system is otherwise updated, ie no other update is pending.
# You can add this script into crontab to run every 5 mins: */5 * * * *
require 'open3'
Open3.popen3("softwareupdate -l --force") do |_stdin, _stdout, stderr, _thread|
unless /No new software available./
exec(%q{osascript -e "display notification \"You have an update available.\""})
attilagyorffy /
Created Sep 18, 2020 — forked from ChaosJohn/
Run Arch Linux in xhyve
tmp=$(mktemp -d)
pushd "$tmp"
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=$iso bs=2k skip=1 >> tmp.iso
echo "mounting disk"
attilagyorffy / Duotone Dark.tmTheme
Created Sep 3, 2020 — forked from simurai/Duotone Dark.tmTheme
DuoTone dark theme for TextMate
View Duotone Dark.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: -->
<!-- code: -->
<plist version="1.0">
<string>Duotone Dark</string>
attilagyorffy / tux.output
Created Feb 18, 2018
tux output in luma.examples on a nanopi neo air
View tux.output
root@NanoPi-NEO-Air:~# git clone
Cloning into 'luma.core'...
remote: Counting objects: 1338, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 1338 (delta 12), reused 15 (delta 5), pack-reused 1304
Receiving objects: 100% (1338/1338), 376.52 KiB | 0 bytes/s, done.
Resolving deltas: 100% (791/791), done.
Checking connectivity... done.
root@NanoPi-NEO-Air:~# cd luma.core
root@NanoPi-NEO-Air:~/luma.core# pip install -e .
attilagyorffy / gist:66552d48dd6f281b6c3a335f1d184074
Created Jan 27, 2018
Connect to Neo Air (or anything really) over serial. On a windows machine.
View gist:66552d48dd6f281b6c3a335f1d184074

For Windows:

  • Download and install Putty

  • Connect your USB to UART adapter from your computer to your Nano Pi Neo Air (or any COM device)

  • Make sure you connect TX>RX and RX>TX (Sending/Receiving), otherwise both your devices are talking at the same time and neither one is being heard.

  • On Windows OS, pull up the Device Manager

    • Run Windows (WinKey+R) and type in devmgmt.msc
attilagyorffy / Dockerfile
Last active May 2, 2021
Ruby 2.4.3 on Alpine Linux using jemalloc Segmentation fault during make
View Dockerfile
FROM alpine:3.7
RUN apk add --update-cache gcc libc-dev curl jemalloc-dev make linux-headers
RUN mkdir -p /usr/src/ruby
RUN cd /usr/src/ruby
RUN curl "" | tar -xz
RUN cd ruby-2.4.3 && ./configure --enable-shared --with-jemalloc --disable-install-doc && make
attilagyorffy / gist:5def7f6677e027ea421e933380698067
Created Sep 18, 2017 — forked from ChickenProp/gist:3183960
Expanding the Raspberry Pi's GPIO capabilities with the MCP23017
View gist:5def7f6677e027ea421e933380698067


The MCP23017 is an I/O expander chip. It has 16 GPIO pins which you can control using an I2C interface using two pins from a Raspberry Pi, plus a power source and sink (which can also come from the Pi). It's not quite as simple as directly controlling the Pi's GPIO pins, but it's not complicated, either.

You need to install i2c-tools, which is probably in your distribution's package manager. You also need a kernel with I2C support; you might need to modprobe i2c-dev. It would presumably be possible to do without either of these things, and bitbang the I2C protocol over GPIO, but I don't understand the protocol well enough to try.

On pin numbering: if you like, you can refer to the datasheet for the MCP23017. There's a small dot in one corner of the chip, with a semi-circular cut-out at that end. The pin near

attilagyorffy /
Created Aug 9, 2017
Import a PostgreSQL production database locally via a pipe
ssh -C "sudo -u postgresuser PASSWORD="password" pg_dump production_database_name" | psql local_database_name