This file contains hidden or 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/ruby | |
| loop do | |
| Machine.all.each do |m| | |
| m.alive? | |
| puts "#{m.name} is #{m.mstatus}" | |
| end | |
| @home = Home.first | |
| @desktop = Machine.find(3) |
This file contains hidden or 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
| require 'ping' | |
| require 'socket' | |
| require 'net/ssh' | |
| require 'wol.rb' | |
| class Machine < ActiveRecord::Base | |
| def alive? | |
| if Ping.pingecho(self.ip, 2) | |
| self.mstatus = "up" |
This file contains hidden or 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
| stringDistance: function(s1, s2) { | |
| // sift3: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html | |
| if (s1 == null || s1.length === 0) { | |
| if (s2 == null || s2.length === 0) { | |
| return 0; | |
| } else { | |
| return s2.length; | |
| } | |
| } |
This file contains hidden or 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/bash | |
| HOST="email.com:1234" | |
| USER="username" | |
| PASS="password" | |
| LCD="/path/to/local/dir" | |
| RCD="/path/to/remote/dir" | |
| if [ ! -e "/tmp/xfer" ] | |
| then | |
| touch /tmp/xfer |
This file contains hidden or 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
| " Clear all types of comments | |
| map _ :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR> | |
| " Add a # comment at the begining | |
| map - :s/^/#/<CR>:nohlsearch<CR> |
This file contains hidden or 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
| filetype on | |
| augroup vimrc_filetype | |
| autocmd! | |
| autocmd FileType ruby call s:RubyCommenter() | |
| autocmd FileType vim call s:VimCommenter() | |
| augroup end | |
| map _ :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR> |
This file contains hidden or 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
| tell application "Google Chrome" | |
| activate | |
| set theUrl to "http://calendar.google.com" | |
| if (count every window) = 0 then | |
| make new window | |
| end if | |
| tell window 1 to make new tab with properties {URL:theUrl} | |
| end tell |
This file contains hidden or 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
| require 'bigquery' | |
| opts = {} | |
| opts['client_id'] = '1234.apps.googleusercontent.com' | |
| opts['service_email'] = '1234@developer.gserviceaccount.com' | |
| opts['key'] = '/path/to/somekeyfile-privatekey.p12' | |
| opts['project_id'] = '54321' | |
| opts['dataset'] = 'yourdataset' | |
| bq = BigQuery.new(opts) |
This file contains hidden or 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
| { | |
| "error": { | |
| "message": "Unsupported get request.", | |
| "type": "GraphMethodException", | |
| "code": 100 | |
| } | |
| } |
This file contains hidden or 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
| brunch new MyApp --skeleton git@github.com:abronte/brunch-with-trigger.git |