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/env ruby | |
## Setting up files for a new Bundler/RVM Ruby project | |
## $ make_ruby_project some_new_project | |
## | |
## This could be cleaner split into multiple files and seperate templates | |
## But a single file in the your bin directory is easier to manage | |
## | |
## A More mainstream version is part of bundler | |
## bundle gem some_new_project | |
## |
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
# /etc/fstab: static file system information. | |
# | |
# Use 'blkid -o value -s UUID' to print the universally unique identifier | |
# for a device; this may be used with UUID= as a more robust way to name | |
# devices that works even if disks are added and removed. See fstab(5). | |
# | |
# <file system> <mount point> <type> <options> <dump> <pass> | |
proc /proc proc nodev,noexec,nosuid 0 0 | |
# / was on /dev/sde1 during installation | |
UUID=59a61ceb-fee3-460a-97c5-e9f115776daf / ext4 errors=remount-ro 0 1 |
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
BaseDir=$(dirname $(which ${0})) |
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
def sensible_sort(unsorted) | |
return unsorted.sort_by {|k| k.to_s.split(/((?:(?:^|\s)[-+])?(?:\.\d+|\d+(?:\.\d+?(?:[eE]\d+)?(?:$|(?![eE\.])))?))/ms).map{|v| Float(v) rescue v.downcase}} | |
end | |
# 1 | |
# 2 | |
#11 | |
#12 | |
##not |
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
//To change the way (below) is displayed | |
$display("%t", $realtime); | |
//$timeformat(unit#, prec#, "unit", minwidth); | |
$timeformat(-3, 2, " ms", 10); // -3 and " ms" give useful display msg | |
unit is the base that time is to be displayed in, from 0 to -15 | |
precision is the number of decimal points to display. | |
"unit" is a string appended to the time, such as " ns". | |
minwidth is the minimum number of characters that will be displayed. |
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
SEPERATOR = '[-\._ ]' | |
def SEPERATOR? | |
"#{SEPERATOR}?" | |
end |
Among many differences are: a much better object system and much better functionals (being stuck with $_ is damned ugly IMO)...I write a lot of Perl code and practically think in it, but Ruby is still way easier for me to read. -- TheerasakPhotha
[ruby-lang][source2]
more powerful than Perl, and more object-oriented than Python
Visual apperance
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
names = {}; | |
for i=1:10 | |
names{end+1} = 'string'; | |
end | |
%% http://stackoverflow.com/questions/2288899/cell-array-appending-in-matlab |