Skip to content

Instantly share code, notes, and snippets.

View armins's full-sized avatar

Armin Schreger armins

View GitHub Profile
require 'resolv'
module ResolveHost
def ResolveHost.lookup(name)
begin
Resolv.getaddress(name)
rescue Resolv::ResolvError
false
end
end
@armins
armins / tmux-lsa.rb
Created March 9, 2017 12:52 — forked from dohzya/tmux-lsa.rb
List tmux sessions (for every sockets)
#!/usr/bin/env ruby
sockets = %x(ps ax -o args=).lines.grep(/tmux.*-L/).map{|l| l.chomp.match(/-L +([^ ]+)/)[1] }.uniq
servers = [['default', nil]] + sockets.sort.map{|s| [s, s] }
res = []
servers.each do |srv, sock|
res << "#{srv}:"
arg = sock ? "-L #{sock}" : ""
%x(tmux #{arg} ls 2> /dev/null).each_line{|l| res << "- #{l.chomp}" }
res << ""
@armins
armins / optparse-template.rb
Created March 6, 2017 16:11 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"

Keybase proof

I hereby claim:

  • I am armins on github.
  • I am armins (https://keybase.io/armins) on keybase.
  • I have a public key whose fingerprint is EBA2 D414 AB0E 818C 7A0E 6434 0D7E A0D9 A268 DDE5

To claim this, I am signing this object:

@armins
armins / gist:5b06281a6e6222445df6
Created September 11, 2014 21:35
nokogiri gem installation osx 10.9
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib -v '1.6.3.1'
Building native extensions with: '--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib -v 1.6.3.1'
@armins
armins / training1.txt
Created May 12, 2012 16:27
Beispieltrainingsplan 2er/4er-Split
Trainingsplan Beispiel
# A - Brust, Schulter, Trizeps, Bauch
1. Fliegende
2. Dips
3. Seitheben
4. Pull Over (Brustweitung)
5. Trizeps EH Überkopf sitzend
6. Bauchübung
@armins
armins / fetch_vienna_airquality.rb
Created November 29, 2011 21:38
fetch air quality values from wien.gv.at - "Wiener Luftgüteindex"
require 'nokogiri'
require 'open-uri'
require "pp"
# real url
url = "https://www.wien.gv.at/ma22-lgb/luftsl.htm"
# testing url
local_url = 'luftguete.htm'
doc = Nokogiri::HTML(open(url))
@armins
armins / inheritance_demo.pl
Created November 29, 2010 10:51
show inheritance in perl
use Data::Dumper;
package Package1;
sub new
{
my($class) = shift;
my(%params) = @_;
bless {