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
rv@v:~$ perl -e "print <<'...'; | |
hello | |
world | |
... | |
" | |
hello | |
world | |
rv@v:~$ ruby -e "puts <<'...' | |
hello | |
world |
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
;; My setup is a emacs 24 with emacs prelude installed | |
(global-set-key (kbd "C-?") 'help) ;; help-command from previous versions is not there anymore | |
(global-set-key (kbd "C-h") 'delete-backward-char) ;; because backspace sucks | |
(defun other-window-backward (&optional n) | |
"Select Nth previous window." | |
(interactive "P") | |
(other-window (- (prefix-numeric-value n)))) |
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
import datetime | |
from time import mktime | |
def convert_date_to_datetime(date_object): | |
date_tuple = date_object.timetuple() | |
date_timestamp = mktime(date_tuple) | |
return datetime.datetime.fromtimestamp(date_timestamp) | |
def date_range(how_many=7): | |
for x in range(0, how_many): |
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
package ly.visual; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.util.Date; | |
import javax.servlet.ServletException; | |
import javax.servlet.annotation.WebServlet; |
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
public static String generateString(int length) { | |
String characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
Random rng = new Random(); | |
char[] text = new char[length]; | |
for (int i = 0; i < length; i++) { | |
text[i] = characters.charAt(rng.nextInt(characters.length())); | |
} | |
return new String(text); | |
} |
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
public static byte[] getFileBytes(File file) throws IOException { | |
ByteArrayOutputStream ous = null; | |
InputStream ios = null; | |
try { | |
byte[] buffer = new byte[4096]; | |
ous = new ByteArrayOutputStream(); | |
ios = new FileInputStream(file); | |
int read = 0; | |
while ((read = ios.read(buffer)) != -1) | |
ous.write(buffer, 0, read); |
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
public static String readFileAsString(String fileName) throws java.io.IOException { | |
java.io.InputStream is = new java.io.FileInputStream(fileName); | |
try { | |
final int bufsize = 4096; | |
int available = is.available(); | |
byte data[] = new byte[available < bufsize ? bufsize : available]; | |
int used = 0; | |
while (true) { | |
if (data.length - used < bufsize) { | |
byte newData[] = new byte[data.length << 1]; |
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
/* This is an **unofficial** [SCSS](http://sass-lang.com/) port of preview 2 | |
of the [Deco Grid System](http://deco.gs/). The Deco Grid System was | |
originally written by [Alexander Limi](http://limi.net/) and released under | |
a [public domain/BSD](http://twitter.com/limi/status/10865858377154560) | |
license. | |
This port was created by [Jonathan Wilde](http://www.speedbreeze.com/). | |
Jonathan doesn't deserve much credit, though, since Alexander Limi did all | |
of the hard work. ;) This file is licensed under the same terms as the | |
original Deco Grid System CSS. |
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
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done |
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
require 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' |
NewerOlder