Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@dongola7
dongola7 / backup.sh
Created August 22, 2008 16:00
Backup script using rsync
#!/bin/sh
# Taken from http://samba.anu.edu.au/rsync/examples.html
# This script does personal backups. You will end up with a 7 day
# rotating incremental backup. The incrementals will go into
# subdirectories named after the day of the week, and the
# current full backup goes into a directory called "current".
# directory to backup
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@tlrobinson
tlrobinson / google-translate-drums.js
Created November 30, 2010 06:19
A drum machine for the German Google Translate. See instructions in comments below.
(function() {
// Notes from http://news.ycombinator.com/item?id=1952531
var notes = {
"suspended cymbal":"zk",
"snare":"bschk",
"brush":"pv",
"bass":"bk",
"flam1":"tk",
"roll tap":"vk",
"flam2":"kt",
(function() {
// Notes from http://news.ycombinator.com/item?id=1952531
var notes = {
"suspended cymbal":"zk",
"snare":"bschk",
"brush":"pv",
"bass":"bk",
"flam1":"tk",
"roll tap":"vk",
"flam2":"kt",
@ptrv
ptrv / ChangeGpxTrackName.rb
Created January 31, 2011 00:55
Change track names in GPX files (ruby)
#!/usr/bin/env ruby
# Script for assigning the date of a track in a GPX file as track name.
#
# Usage e.g $ ruby ChangeGpxTrackName.rb source.gpx target.gpx"
#
# Peter Vasil
# Date: 2011-01-31
@ptrv
ptrv / GpxTrackNameChanger.py
Created February 5, 2011 15:18
Change track names in GPX files (python)
#!/usr/bin/python
# Script for assigning the date of a track in a GPX file as track name.
#
# Usage e.g $ python ChangeGpxTrackName.py source.gpx target.gpx"
#
# Peter Vasil
# Date: 2011-02-05
from optparse import OptionParser
@ptrv
ptrv / CreateVersionNumber.py
Last active September 24, 2015 23:38
generating version code from string
#!/usr/bin/python
# Script for generating a software version code(hex) from a version string.
#
# Usage e.g $ python CreateVersionNumber.py 1.4.2"
#
# Peter Vasil
# Date: 2011-02-15
from optparse import OptionParser
@ptrv
ptrv / gitignore-rules-adder.py
Last active September 25, 2015 04:57
Script for adding ignore rules to gitignore files.
#!/usr/bin/python
# Script for adding ignore rules to gitignore files.
#
# Peter Vasil
# Date: 2011-03-11
import sys
from optparse import OptionParser