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
@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
View style.css.patch
diff --git a/style.css b/style.css
index de851c6..b274b91 100644
--- a/style.css
+++ b/style.css
@@ -24,7 +24,7 @@ body {
/* Photo by Daniel Olah on Unsplash */
background-size: cover, cover;
background-repeat: none;
- height: 100vh;
+ min-height: 100vh;
@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:"
View gist:9a80aadd7250d6c967ae9e08b5d18400
/**
* Shamelessly stolen from http://blog.jeansebtr.com/post/36590722386/async-loading-of-githubs-gists-without-jquery-31-loc
*
* Use like this: <gist data-username="brandonb927" data-id="4138162" data-file="gists2.js"><a href="https://gist.github.com/brandonb927/4138162#file_gists2.js">Gist</a></gist>
* UPDATED 02/06/2013: Github implemented Namespaced Gists a few hours ago, which means gist.github.com/4149074 now redirects to gist.github.com/brandonb927/4149074 and I have updated the gist to reflect this new format
*
*/
(function(){
var gists = document.getElementsByTagName('gist');
@attilagyorffy
attilagyorffy / downgrade_to_node6.sh
Created Nov 7, 2016
How to downgrade Node to v6 LTS (Homebrew method)
View downgrade_to_node6.sh
# Things may stop working as you upgrade the version of node on your system.
# Using Homebrew's alternative repo (homebrew/versions) offers you legacy
# and earlier versions of formulae.
brew remove node --force
brew tap homebrew/versions
brew install homebrew/versions/node6-lts
You can’t perform that action at this time.