Skip to content

Instantly share code, notes, and snippets.

View pioz's full-sized avatar
🧙‍♂️
[object Object]

Enrico pioz

🧙‍♂️
[object Object]
View GitHub Profile
@pioz
pioz / naga.ahk
Last active January 11, 2022 17:00
AutoHotkey script for Naga numpad
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
NumpadIns::Numpad0
NumpadEnd::Numpad1
NumpadDown::Numpad2
NumpadPgDn::Numpad3
NumpadLeft::Numpad4
@pioz
pioz / xmas.c
Created December 25, 2014 13:34
Merry Xmas!
#include <stdlib.h>
#include <stdio.h>
int
main()
{int b=63
,l,s,p;for(
int h=0;h<b/2
+1;h++){l=h*2+1
;s=(b-l)/2;for(int
i=0;i<s;i++) printf
@pioz
pioz / gist:dc605517563fb3771273
Last active April 3, 2016 21:59
Concat videos with ffmpeg
ffmpeg -f concat -i <(printf "file '$PWD/%s'\n" file/path/*.avi) -c copy output.avi
@pioz
pioz / gist:737e8d2e5f6d35c72969
Created June 29, 2014 09:21
init.d script for serviio
#! /bin/sh
### BEGIN INIT INFO
# Provides: serviio
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Serviio daemon
# Description: Serviio is a free media server. It allows you to stream your media files (music, video or images) to renderer devices (e.g. a TV set, Bluray player, games console or mobile phone) on your connected home network.
### END INIT INFO
@pioz
pioz / gist:8968325
Created February 13, 2014 01:55
Send imessage by command line
osascript -e 'tell application "Messages" to send "MESSAGE TEXT" to buddy "RECIPIENT_NUMBER_OR_EMAIL" of service "E:YOUR_ID_APPLE"'
@pioz
pioz / youdownloader.rb
Last active August 29, 2015 13:56
Download video as mp3 from youtube
#!/usr/bin/env ruby
require 'open-uri'
require 'cgi'
if ARGV[0].nil?
puts "usage: #{$0} YOUTUBE_VIDEO_ID"
puts " sample: #{$0} wG6G4XBnvLQ"
exit
end
@pioz
pioz / gist:5587388
Created May 15, 2013 21:08
Ruby gstreamer 2.0 don't work for me under ruby-2.0.0-p0
2.0.0-p0 :001 > require 'gst'
=> true
2.0.0-p0 :002 > bin = Gst::ElementFactory.make('playbin')
NameError: uninitialized constant Gst::ElementFactory
from (irb):2
@pioz
pioz / gist:4883502
Created February 13, 2013 02:17
Simple preforking echo server in Ruby
# simple preforking echo server in Ruby
require 'socket'
# Create a socket, bind it to localhost:4242, and start listening.
# Runs once in the parent; all forked children inherit the socket's
# file descriptor.
acceptor = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
address = Socket.pack_sockaddr_in(4242, 'localhost')
acceptor.bind(address)
acceptor.listen(10)
@pioz
pioz / gist:4739362
Last active December 12, 2015 07:49
roflcopter
#!/usr/bin/env ruby
require 'curses'
include Curses
init_screen
curs_set(frame = 0)
Thread.new { system "say -v Alex the rofl copter says #{'siff ' * 1000}" }
@pioz
pioz / gist:3860147
Created October 9, 2012 17:17
Simple video player in Ruby
# Written by Pioz.
#
# Deps:
# sudo apt-get install libgtk2.0-dev libgstreamer0.10-dev gstreamer0.10-plugins-base
# gem install gtk2 gstreamer
require 'gtk2'
require 'gst'
if ARGV.size != 1