Skip to content

Instantly share code, notes, and snippets.

View dabcoder's full-sized avatar

David B. dabcoder

  • Paris
View GitHub Profile
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'}
@dabcoder
dabcoder / collectd.conf
Last active September 20, 2016 20:29
My own Collectd (client server) -> InfluxDB -> Grafana (monitoring server) | configuration files for a personal project
Hostname "localhost"
BaseDir "/var/lib/collectd"
PluginDir "/usr/lib/collectd"
LoadPlugin syslog
LoadPlugin battery
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin entropy
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
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"
let rec last = function
| [] -> None
| [x] -> Some x
| _ :: t -> last t
;;
let mylist = ["a", "b", "e", "z", "o"];;
let r = last mylist;;
#!/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
@dabcoder
dabcoder / main.rs
Last active January 16, 2017 10:28
Rust-Paper-Scissors
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();
{-# 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)