Skip to content

Instantly share code, notes, and snippets.

View FlorianWolters's full-sized avatar

Florian Wolters FlorianWolters

View GitHub Profile
@FlorianWolters
FlorianWolters / Linux_Cheat_Sheet.md
Last active January 4, 2016 00:39
Cheat Sheets and keyboard shortcuts for common software

Linux Cheat Sheet

Samba

Limit Samba access to a specific network interface

kwrite /etc/samba/smb.conf &

[global]

interfaces = eth0 lo

@FlorianWolters
FlorianWolters / FieldCreator.cs
Created August 17, 2013 14:46
Generic algorithm to allow the creation of nested fields with Word.Interop, by using a string. I have taken the Visual Basic for Applications (VBA) source code from [Nested Fields in VBA](http://stoptyping.co.uk/word/nested-fields-in-vba) and adopted it for C#.
//------------------------------------------------------------------------------
// <copyright file="FieldCreator.cs" company="Florian Wolters">
// Copyright (c) Florian Wolters. All rights reserved.
// </copyright>
// <author>Florian Wolters &lt;wolters.fl@gmail.com&gt;</author>
//------------------------------------------------------------------------------
namespace FlorianWolters.Office.Word.Fields
{
using System;
@FlorianWolters
FlorianWolters / NotSoImmutableClassExample.php
Last active December 14, 2015 15:29
The class NotSoImmutableClass demonstrates how-to implement the Immutable Object pattern incorrectly.
<?php
namespace FlorianWolters;
/**
* The class {@see NotSoImmutableClass} demonstrates how-to implement the
* *Immutable Object* implementation pattern **incorrectly**
*
* @author Florian Wolters <wolters.fl@gmail.com>
* @copyright 2013 Florian Wolters
* @license http://gnu.org/licenses/lgpl.txt LGPL-3.0+
@FlorianWolters
FlorianWolters / GitCommands.md
Last active October 11, 2015 00:38
Git command line examples

Record changes to the repository.

git commit -a -m "Merged with local develop branch."

Add a tag and push all tags.

git tag -a v0.1.0 -m "version 0.1.0-stable"
git push origin --tags

Remove a remote tag.

@FlorianWolters
FlorianWolters / Singleton.java
Created May 31, 2012 14:50
Demonstration of the Singleton design pattern in Java.
package de.florianwolters.pattern.singleton;
/**
* Demonstration of the <i>Singleton</i> design pattern in Java.
*
* This is the correct implementation of the <i>Singleton</i> creational design
* pattern in the Java programming language.
*
* - Thread-safe without special language constructs (e.g.
* <tt>synchronized</tt> or <tt>volatile</tt>).
@FlorianWolters
FlorianWolters / lastDayOfLastMonth.cmd
Created April 27, 2012 14:21
Prints out the last date of the last month in optional DIN 5008 format.
@ECHO OFF
REM Prints out the last date of the last month in optional DIN 5008 format.
REM
REM The optional DIN 5008 format is "dd.mm.yyyy", e.g. "29.02.2012".
REM
REM Author: Florian Wolters <florian.wolters.85@googlemail.com>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
@FlorianWolters
FlorianWolters / lastDayOfCurrentMonth.cmd
Created April 26, 2012 15:37
Prints out the last day of the current month.
@ECHO OFF
REM Prints out the last day of the current month.
REM
REM Author: Florian Wolters <florian.wolters.85@googlemail.com>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
REM This program is free software: you can redistribute it and/or modify it
REM under the terms of the GNU Lesser General Public License as published by the
@FlorianWolters
FlorianWolters / CleanUpRemovableDisk.cmd
Created February 20, 2012 22:22
Removes the directories "System Volume Information" and "$RECYCLE.BIN" from the drive with the specified drive letter.
@ECHO OFF
REM Removes the directories "System Volume Information" and "$RECYCLE.BIN" from
REM the drive with the specified drive letter.
REM
REM Author: Florian Wolters <florian.wolters.85@googlemail.com>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
REM This program is free software: you can redistribute it and/or modify it
@FlorianWolters
FlorianWolters / the_rule_of_five.h
Created January 31, 2015 15:38
C++ source code examples for the weblog article "The Rule of Zero"
/**
* Demonstrates *The Rule of Five* C++ idiom.
*
* @file the_rule_of_five.h
* @author Florian Wolters <wolters.fl@gmail.com>
*
* @section License
*
* Copyright Florian Wolters 2015 (http://blog.florianwolters.de).
*
@FlorianWolters
FlorianWolters / pause.sh
Created December 28, 2014 17:57
Windows `pause` command in *-nix Shell (Bash)
#!/bin/bash
function pause() {
if [ "$#" -eq 0 ]
then
PROMPT="Press any key . . ."
else
PROMPT="$1"
fi