This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)"; | |
if /sbin/ifconfig tun0; then | |
echo "VPN is active"; | |
else | |
DISPLAY=:0 notify-send "VPN is not active" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var file = ... // a File web API interface: https://developer.mozilla.org/en-US/docs/Web/API/File | |
img = new Image(); | |
img.src = URL.createObjectURL(file); | |
img.onload = function() { | |
alert(this.naturalWidth); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's not localize programming languages. Please >_< | |
# | |
# Feel free to fork and expand and/or add more languages as an example | |
# to why this would be horrible, and I'll add them here :) | |
# Ruby in English | |
if user.is_alive? | |
# send spam mail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- debugging | |
on log_event(themessage) | |
set theLine to (do shell script "date +'%Y-%m-%d %H:%M:%S'" as string) & " " & themessage | |
do shell script "echo " & theLine & " >> ~/Library/Logs/AppleScript-events.log" | |
end log_event | |
-- Extract the album name from the session file | |
on extractAlbumName(sessionContents) | |
set albumName to "" | |
set allLines to every paragraph of sessionContents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
app = "your-heroku-app" | |
STDOUT.sync = true | |
start_time = Time.now | |
# Fail if the previous dump did not end well | |
if File.exist?("#{app}.dump.backup") | |
puts "\e[31mThe previous dump did not end well, check manually.\e[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize the Raphael object | |
var r = Raphael("holder"); | |
// Assign the values for the X axis | |
var x = [1, 2, 3, 4]; | |
// Assign the values for the Y axis | |
var y = [1, 2, 1, 3]; | |
// Draw a line chart (startX, startY, width, height, valuesX, valuesY) | |
r.g.linechart(0, 0, 300, 220, x, y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'gnuplot' | |
if ARGV[0] | |
source = ARGV[0] | |
else | |
puts "usage: ./gpx2image source_file" | |
exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
app = "your-heroku-app" | |
STDOUT.sync = true | |
start_time = Time.now | |
# Prepare old backup for rotate if needed | |
if File.exist?("#{app}.tar.gz.backup") | |
puts "\e[31mThe previous backup did not end well, check manually.\e[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'cgi' | |
require 'open-uri' | |
require 'hpricot' | |
current_time = Time.now.strftime("%H:%M") | |
url = "" | |
user_agent = "Mozilla/5.0 (X11; U; CrOS i686 9.10.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.253.0 Safari/532.5" |
NewerOlder