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
{-# LANGUAGE OverloadedStrings #-} | |
--http://www.serpentine.com/wreq/tutorial.html | |
import Network.Wreq | |
import Control.Lens | |
import Data.Aeson.Lens (_String, key) | |
import Data.Aeson (Value, FromJSON, Value(Object)) | |
import Data.Text (Text) |
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 rand; | |
use std::io; | |
use rand::Rng; | |
fn main() { | |
//Player's turn | |
println!("1 - Rock, 2 - Paper, 3 - Scissors"); | |
let mut players_choice = String::new(); |
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 | |
for file in /Users/my_user/Documents/* | |
do | |
if [[ -f $file ]]; then | |
filesize=`wc -c "$file" | awk '{print $1}'` | |
if [[ (( $filesize -gt 10000000 )) ]]; then | |
echo "Do you want to remove: $file which is $filesizeB Y/n?" | |
read answer | |
if [ $answer == "y" ] || [ $answer == "Y" ]; then |
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
let rec last = function | |
| [] -> None | |
| [x] -> Some x | |
| _ :: t -> last t | |
;; | |
let mylist = ["a", "b", "e", "z", "o"];; | |
let r = last mylist;; |
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
print_string "****************************************\n";; | |
print_string "Welcome to the rock-paper-scissors game!\n";; | |
print_string "****************************************\n";; | |
(*Player's choice*) | |
print_string "What is your choice? 1 for Rock, 2 for Paper, 3 for Scissors: ";; | |
let pchoice = match read_int () with | |
| 1 -> "Rock" |
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
print_string "****************************************\n";; | |
print_string "Welcome to the rock-paper-scissors game!\n";; | |
print_string "****************************************\n";; | |
print_string "\n";; | |
print_string "What is your choice? 1: Rock, 2: Paper, 3: Scissors\n";; | |
flush stdout; | |
(*For the user's choice - no error handling for now*) | |
let answer = input_line stdin in |
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
Hostname "localhost" | |
BaseDir "/var/lib/collectd" | |
PluginDir "/usr/lib/collectd" | |
LoadPlugin syslog | |
LoadPlugin battery | |
LoadPlugin cpu | |
LoadPlugin df | |
LoadPlugin disk | |
LoadPlugin entropy |
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
import random | |
import time | |
import random | |
print("****************************************") | |
print("Welcome to the rock-paper-scissors game!") | |
print("****************************************") | |
#Create the data structure, a dictionary for the choices | |
options = {1: 'Paper', 2: 'Rock', 3:'Scissors'} |