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 'fileutils' | |
| musics = Dir["*.mp3"] | |
| musics.each do |music| | |
| band_name = music.split("-").first | |
| dir_destiny = "#{band_name}/" | |
| Dir.mkdir(band_name) unless File.exists? band_name | |
| FileUtils.mv music, dir_destiny | |
| end |
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
| use std::net::UdpSocket; | |
| extern crate rustc_serialize; | |
| use rustc_serialize::json; | |
| use std::str; | |
| use std::string::String; | |
| fn main() { | |
| match main_loop() { | |
| Err(e) => panic!(e), | |
| _ => () |
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
| extern crate iron; | |
| use iron::prelude::*; | |
| use iron::status; | |
| fn main() { | |
| Iron::new(|_: &mut Request| { | |
| Ok(Response::with((status::Ok, "É bom esse iron!"))) | |
| }).http("localhost:3000").unwrap(); | |
| } |
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
| // Responsible for calcule Collatz Conjecture | |
| // n -> n/2 (if n is pair) n -> 3n + 1 (if n is odd) | |
| // | |
| fn calcule(num: u64) -> u64 { | |
| if num <= 1 { return 1; }; | |
| if num % 2 == 0 { | |
| num / 2 | |
| } else{ | |
| 3 * num + 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
| #!/usr/bin/env python | |
| import sys, os, time, atexit | |
| from signal import SIGTERM | |
| class Daemon: | |
| """ | |
| A generic daemon class. | |
| Usage: subclass the Daemon class and override the run() method |
NewerOlder