- Systems programming language (safety & control)
- Stack (default) vs. heap allocated vars
- Statically typed, although the type inference is pretty sweet
- Statement and expression based langguage
- Features structs, enums and traits
- Static (favored) & dynamic method dispatch
- Has generics & type bounds
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 | |
# Debian pkg dependencies: | |
# - pngcrush | |
# - libjpeg-progs | |
# - imagemagick | |
# Usage: optimize-images graphic1.png photo1.jpeg bash-glob-exp1 | |
require "fileutils" |
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
### Keybase proof | |
I hereby claim: | |
* I am cristianrasch on github. | |
* I am cristianrasch (https://keybase.io/cristianrasch) on keybase. | |
* I have a public key whose fingerprint is 9B78 E79A FCEE 4DBB 081E BD88 BC00 AA23 CB3D 2E3F | |
To claim this, I am signing this object: |
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
use std::fmt; | |
pub struct Roman { | |
number: String, | |
} | |
impl Roman { | |
pub fn from(n: u32) -> Roman { | |
let roman_numbers: [(u32, &str); 13] = [(1000, "M"), (900, "CM"), (500, "D"), | |
(400, "CD"), (100, "C"), (90, "XC"), |
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
#[derive(Debug, PartialEq)] | |
pub struct RibonucleicAcid<'a> { | |
nucleotides: &'a str, | |
} | |
impl<'a> RibonucleicAcid<'a> { | |
pub fn new(nucleotides: &str) -> RibonucleicAcid { | |
RibonucleicAcid { nucleotides: nucleotides } | |
} | |
} |
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
check process torquebox with pidfile /var/run/torquebox/torquebox.pid | |
start program = "/usr/sbin/service torquebox start" with timeout 60 seconds | |
stop program = "/usr/sbin/service torquebox stop" with timeout 30 seconds | |
if not exist for 3 cycles then restart | |
if failed | |
host example.com | |
port 443 | |
type tcpssl | |
protocol https | |
request "/your-path" |
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
10:05:22,892 ERROR [org.torquebox.messaging] (Thread-2 (HornetQ-client-global-threads-502691840)) Unexpected error in /queues/torquebox/db_user-production/tasks/torquebox_backgroundable.TorqueBox::Messaging::BackgroundableProcessor: org.jruby.exceptions.RaiseException: (DatabaseConnectionError) Java::JavaSql::SQLException: No suitable driver found for jdbc:postgresql://localhost/database?user=db_user&password=db_passwd | |
at RUBY.make_new(/opt/torquebox/www/db_user-production/shared/bundle/jruby/1.9/gems/sequel-4.22.0/lib/sequel/connection_pool.rb:110) at RUBY.make_new(/opt/torquebox/www/db_user-production/shared/bundle/jruby/1.9/gems/sequel-4.22.0/lib/sequel/connection_pool/threaded.rb:214) at RUBY.available(/opt/torquebox/www/db_user-production/shared/bundle/jruby/1.9/gems/sequel-4.22.0/lib/sequel/connection_pool/threaded.rb:187) at RUBY._acquire(/opt/torquebox/www/db_user-production/shared/bundle/jruby/1.9/gems/sequel-4.22.0/lib/sequel/connection_pool/threaded.rb:127) at RUBY.acquire(/opt/torquebox/www/db_us |
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
module TestHelper | |
module RequestClassMethods | |
def test_req_class_method | |
@req_class_ivar ||= 0 | |
@req_class_ivar += 1 | |
p "---" | |
p @req_class_ivar | |
p "---" | |
end | |
end |
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
===== | |
Usage | |
===== | |
Basic request: | |
curl --insecure --silent -H "X-API-Key: the-api-key" https://the-host/rankings | |
# => {"error":"Either a keyword, brand or competitor param is required."} | |
You need to include either a keyword, competitor or both params, which are detailed below. |
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
# Generate your backup private key and certificate | |
openssl req -nodes -newkey rsa:1536 -x509 -keyout backup.key -out backup.crt | |
# Encrypt your data to a temporary folder | |
rsyncrypto --verbose --ne-nesting=2 --trim=2 --name-encrypt=/tmp/rsyncrypto-map --delete-keys --changed --recurse /home/cristian/Dropbox/ /tmp/Dropbox/ /tmp/rsyncrypto-keys ~/Dropbox/backups/laptop/crypto/rsyncrypto/backup.crt | |
# Send it over the network | |
rsync --verbose --archive --compress --delete /tmp/Dropbox/ pi:~/backups/laptop | |
# Decryption time! |