Skip to content

Instantly share code, notes, and snippets.

View Nielsrj's full-sized avatar

Niels Johansen Nielsrj

View GitHub Profile
@Nielsrj
Nielsrj / marsLander
Last active August 8, 2017 21:22
Codeingame.com - Mars Lander EP 1
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
@Nielsrj
Nielsrj / temp.cs
Last active August 8, 2017 21:11
Codingame.com -- Temperatures (C#)
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
@Nielsrj
Nielsrj / shutdown_vms.sh
Created March 30, 2017 14:16
Shutdown all running nodes kvm nodes.
LIST_VM=`virsh list | grep running | awk '{print $2}'`;
for i in $LIST_VM;
do
virsh shutdown $i;
done
@Nielsrj
Nielsrj / Zero_file_size.sh
Created March 30, 2017 14:15
Number of files and folder size + list of files that have a size of 0
for file in *; do
if [[ -d "$file" ]]; then
echo "$file is a directory"
du -sh $file
ls $file | wc -l
find $file -size 0
fi
done
# If you have used urllib to get the files from a server, you will need to replace the following line:
@Nielsrj
Nielsrj / files_and_size.sh
Last active March 30, 2017 14:13
Finds all files and their size in a directory
for file in *; do
if [[ -d "$file" ]]; then
echo "$file is a directory"
du -sh $file
ls $file | wc -l
fi
done
@Nielsrj
Nielsrj / .bashrc
Created September 19, 2016 15:35
bashrc file - custom aliases and exports, also has a couple of useful functions.
#########
# Aliases
#########
# Change directory
alias cd..='cd ..'
alias ..='cd ..'
alias .2='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
@Nielsrj
Nielsrj / Preferences.sublime-settings
Created October 18, 2013 08:05
My settings for sublime text 3
{
"bold_folder_labels": true,
"caret_style": "smooth",
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "all",
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"font_face": "Consolas",
"font_size": 13,