Skip to content

Instantly share code, notes, and snippets.

Avatar
🦜
A UDP packet bar walks a into...

Attila Györffy attilagyorffy

🦜
A UDP packet bar walks a into...
View GitHub Profile
@attilagyorffy
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 stderr.read.match? /No new software available./
exec(%q{osascript -e "display notification \"You have an update available.\""})
end
end
@attilagyorffy
attilagyorffy / arch-xhyve.sh
Created Sep 18, 2020 — forked from ChaosJohn/arch-xhyve.sh
Run Arch Linux in xhyve
View arch-xhyve.sh
#!/bin/bash
tmp=$(mktemp -d)
pushd "$tmp"
iso=/Users/lloeki/Downloads/archlinux-2015.08.01-dual.iso
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
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Duotone Dark</string>
@attilagyorffy
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 https://github.com/rm-hull/luma.core.git
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
attilagyorffy / gist:66552d48dd6f281b6c3a335f1d184074
Created Jan 27, 2018 — forked from BiTinerary/gist:5d759c5715c2432e9830842171f97c4c
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
attilagyorffy / Dockerfile
Last active Jan 30, 2019
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 "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.gz" | tar -xz
RUN cd ruby-2.4.3 && ./configure --enable-shared --with-jemalloc --disable-install-doc && make
@attilagyorffy
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

Introduction

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
attilagyorffy / import_procuction.sh
Created Aug 9, 2017
Import a PostgreSQL production database locally via a pipe
View import_procuction.sh
ssh -C myproductionhost.com "sudo -u postgresuser PASSWORD="password" pg_dump production_database_name" | psql local_database_name
@attilagyorffy
attilagyorffy / application_helper.rb
Created Jun 11, 2017
Responsive Images in Rails applications
View application_helper.rb
module ApplicationHelper
def responsive_image_tag(image, options = {})
content_tag(:picture) do
concat content_tag(:source, nil, media: '(max-width: 768px)', srcset: image.url(:thumbnail_mobile))
concat content_tag(:source, nil, media: '(max-width: 960px)', srcset: image.url(:thumbnail_tablet))
concat image_tag(image.url(:thumbnail_desktop), options)
end
end
end
@attilagyorffy
attilagyorffy / .gitconfig
Created Dec 12, 2016
Git URL shortcuts to github and heroku
View .gitconfig
# Allow cloning repositories using shortcuts.
# For example:
# git clone gh:attilagyorffy/foo
[url "git@github.com:"]
insteadOf = gh://
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"