Skip to content

Instantly share code, notes, and snippets.

@hugot
hugot / odd.sh
Last active February 13, 2017 20:14
I am doing python tutorials in bash, call me crazy
#!/usr/bin/env bash
#----- Functions -----
divide() {
echo $(( $(($1 * 100)) / $2))
}
multipleOfFour() {
result=$(divide $1 2)
[[ ${result#*0} == *0* ]]
}
@hugot
hugot / compare_array.sh
Created February 13, 2017 22:32
another python tutorial in bash :)
#!/usr/bin/env bash
#This script asks the user to provide a number and then compares that number to the numbers in an array
array=(1 2 3 4 5 6 7 8 9 10 11 12 13 14)
otherArray=()
echo please provide a number to compare
read number
for ((i=0; i<${#array[@]}; i++)); do
@hugot
hugot / divisors.sh
Created February 13, 2017 23:09
calculating divisors the bash way
#!/usr/bin/env bash
# This script asks the user for a number and then provides the user with
# all even divisors for it
#----- functions -----
evenDivision() {
local result=$(( $((100 * $1)) / $2))
[[ "${result#*0}" == 0 ]]
}
#!/usr/bin/env perl
# This is a short script to play rock paper scissors
use strict;
use warnings;
my @rps = qw(rock paper scissors);
my %weakness = (rock => "paper", paper => "scissors", scissors => "rock");
my $score = 0;
my $npcscore = 0;
#!/usr/bin/env bash
#
# image_sorter.sh
# Copyright (C) 2017 Hugo
#
# Distributed under terms of the MIT license.
#
# This script will sort the image and video files from an android phone by date by placing them in directories
# according to the dates that can be extracted from the filename. The filenames of the images must be structured
# as follows: yyyymmdd_HHMMSS.jpg or yyyymmdd_HHMMSS.mp4 (other extentions can be added easily)
@hugot
hugot / cloudSettings
Created June 3, 2017 20:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-06-03T20:54:54.028Z","extensionVersion":"v2.8.1"}
@hugot
hugot / cloudSettings
Created June 3, 2017 21:04
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-06-03T21:04:31.484Z","extensionVersion":"v2.8.1"}
// cmd: cat dikkie.json | POST -sS "http://127.0.0.1:5984/dikkie/_bulk_docs" -c "application/json"
{
"docs": [
{
"Voornaam": "Sander",
"id": 7064,
"Achternaam": "Lauridsen",
"Geboortedatum": "1-nov-76",
"Straat": "Taylorweg 70",
"Postcode": "5466AE",
#! /usr/bin/env bash
#
# replaceslash.sh
# Copyright (C) 2017 hugo <hugo@supersudomachine>
#
# Distributed under terms of the MIT license.
#
[ -f NClass.build ] || (
echo failed to find the build file, execute this script in the root of the NClass project && exit 1
package nl.hva.dmci.ict.se.datastructures.fibonacci;
import java.math.BigInteger;
import java.util.function.Consumer;
import edu.princeton.cs.algs4.Stopwatch;
public class FastFibonacci {
static double timeStart;