Skip to content

Instantly share code, notes, and snippets.

@MechMK1
MechMK1 / addSVN.sh
Created December 25, 2014 00:38
Quickly create a new SVN repository and make it accessible via WebDAV
#!/bin/bash
#CFG
#Paths to directories must NOT end with /
SVNPARENT="/var/svn"
APACHECFG="/etc/apache2"
APACHESVN="/etc/apache2/svn"
USEMASTER=false #Prefer individual set to true to always use master or use -m to change individually
MASTERPASSWD="${APACHESVN}/master.passwd"
MASTERREALM="REALM" #Change
@MechMK1
MechMK1 / flags.sh
Created December 25, 2014 10:43
Framework for flags in bash scripts
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "$0 [options] something"
echo " "
echo "options:"
echo " -h, --help show brief help"
echo " -a, --action=ACTION specify an action to use"
echo " -o, --output-dir=DIR specify a directory to store output in"
exit 0
@MechMK1
MechMK1 / gist:ca08d51fc936988b7b8a
Created February 17, 2015 15:41
C# Singletons
class Singleton
{
//Private static field to hold the instance
private static Singleton _singleton = null;
// Getter for the instance
public static Singleton Instance
{
get
{
@MechMK1
MechMK1 / 01Basics.cs
Last active August 29, 2015 14:15
LINQ Overview
static void Main(string[] args)
{
// Let us define some data in an IEnumerable<T>
List<int> data = new List<int> { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };
// Let's define a simple query
var query = from i in data
where i > 10
select i;

Keybase proof

I hereby claim:

  • I am MechMK1 on github.
  • I am mechmk1 (https://keybase.io/mechmk1) on keybase.
  • I have a public key whose fingerprint is F41A FA8B 9691 F516 A1B0 C6C7 E886 9F7B 70BD DFB0

To claim this, I am signing this object:

public void WriteLog(string message)
{
WriteLog(message, Logger.Defaults.Severity, Logger.Defaults.Encoding, Logger.Defaults.Color);
}
public void WriteLog(string message, Severity severity)
{
WriteLog(message, severity, Logger.Defaults.Encoding, Logger.Defaults.Color);
}
public void WriteLog(string message,
Severity severity = Logger.Defaults.Severity,
Encoding = Logger.Defaults.Encoding,
Color = Logger.Defaults.Color)
{
/*Write your log here*/
}
public void Main()
{
@MechMK1
MechMK1 / SQLTux.sh
Last active October 22, 2016 13:15
#!/bin/bash
# Skript: m122_Scripts/SQLTux.sh
DBFILE=linuxusers.db
PASSWDFILE=/etc/passwd
TABLENAME="LinuxBenutzer"
#Stop if the password file is not readable
if ! [ -r "$PASSWDFILE" ]
then
@MechMK1
MechMK1 / Max.cs
Last active October 24, 2016 09:32
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Liest 10 Gleitkomma-Zahlen ein und speichert sie in ein Array.
double[] numbers = ReadNumbers(10);
@MechMK1
MechMK1 / Memory.cs
Created November 9, 2016 18:03
Memory implemented in C#
using System;
namespace Memory
{
class Program
{
/// <summary>
/// Motives of the pairs
/// </summary>
private static char[] displaySymbols = { '@', '☺', '☻', '●', 'Ⱡ', '♫', '♪', '♦', '♥', '♣', '♠', '♂', '♀', '☼', '█', '▲', '℗', 'Ω' };