Skip to content

Instantly share code, notes, and snippets.

Peter Vojtek petervojtek

Block or report user

Report or block petervojtek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
petervojtek / btraced.rb
Last active Jan 3, 2016
Simple Btraced server in Ruby.
View btraced.rb
require 'stringio'
require 'active_support/core_ext/hash'
require 'json'
require 'sinatra'
get '/' do
'I am btraced server, send POST requests to me '
post '/' do
View wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
New PPPD = yes
Modem = /dev/ttyUSB0
; Baud = 9600
Init4 = AT+CGDCONT=1,"IP","internet"
Stupid Mode = 1
View shutdown-raspberry-pi.rb
require 'rubygems'
require 'pi_piper'
include PiPiper
press_times = []
after :pin => 25, :goes => :down do
now =
press_times.each{|t| puts (now - t) }
View pcd8544.rb
# Aim of this script is to use 7-segment PDR8544 display (nokia 3110) from Ruby on Raspberry Pi.
# The script is 1:1 rewrite of this Hello World code for Arduino:
# Now the issue - the code below is not working properly for some reason.
# What works well is settings the contrast of display, but displaying the text itself ends with following screen content:
# Any help is appreciated.
petervojtek / air_pump.ino
Last active Dec 21, 2015
arduino air pump aquarium
View air_pump.ino
int motorSpeedPin = 11;
int motorOnPin = 10;
void setup()
pinMode(motorOnPin, OUTPUT);
pinMode(motorSpeedPin, OUTPUT);
digitalWrite(motorOnPin, 1);
View water_drop.rb
# sudo crontab -e
# 0 * * * * ruby /home/pi/Repositories/water_drop/src/water_drop.rb
puts "Water Drop: started"
unless | File::LOCK_NB)
puts "Water Drop: There is already an instance running, I quit"
exit 1
View stepper_motor.rb
require 'rubygems'
require 'pi_piper'
include PiPiper
motor_sequence = [
[true, false,false,false],
[true, true, false,false],
[false,true, false,false],
[false,true, true, false],
[false,false,true, false],
petervojtek / mocp_rpi.rb
Created Jun 14, 2013
BerryClip Raspberry Pi + Music on Console (mocp)
View mocp_rpi.rb
require 'pi_piper'
include PiPiper
`su pi -c \"mocp -S\"`
red_led = => 4, :direction => :out)
green_led = => 11, :direction => :out)
after :pin => 7, :goes => :high do
petervojtek / devices
Last active Oct 25, 2017
shell script to print list of devices( and ip addresses) connected to ZyXEL P-660HW-T3v2 router
View devices
# zyxel P-660HW-T3v2 router
# purpose of this script: print list of connected devices (ip + device hostname) to shell
# example: peter@peter-laptop:~/$ ./devices
# peter-laptop
# android-d8006
# Notebook
# raspberrypi
petervojtek / gist:4316754
Created Dec 17, 2012
Ruby Garbage Collector not garbage collecting as expected
View gist:4316754
# Ruby MRI 1.9.2 p136
class Person
def self.destructor name
proc{ puts "I AM DYING: #{name}"}
attr_reader :name
def initialize name
You can’t perform that action at this time.