Skip to content

Instantly share code, notes, and snippets.

View outlook2016-autohotkeys.ahk
;*******************************************************************************
; Information
;*******************************************************************************
; AutoHotkey Version: 3.x
; Language: English
; Platform: XP/Vista/7
; Updated by: Toby Garcia
; Previously updated by: Ty Myrick
; Author: Lowell Heddings (How-To Geek)
; URL: http://lifehacker.com/5175724/.....gmail-keys
@mattanja
mattanja / dovecot-untrash-all
Last active Nov 19, 2015
Rename all files in a dovecot Maildir removing the "T" flag (T=Trash)
View dovecot-untrash-all
#!/bin/bash
#
# (c) 2015 Mattanja Kern <mattanjakern.de>
#
# DOVECOT Maildir remove T="Trash" flag from all files in folders.
#
removeTrashFromFileName() {
rename 's/(.+),ST$/$1,S/' "$1"
rename 's/(.+),RST$/$1,RS/' "$1"
View MS-Database-Backup.sql
DECLARE @datestring [nvarchar](10) = CONVERT(nvarchar, GETDATE(), 126);
DECLARE @filepath [nvarchar](max) = N'C:\Data\BackupDatabase\' + @datestring + N'-DBNAME.bak';
SELECT @filepath;
BACKUP DATABASE [DBNAME]
TO DISK = @filepath
WITH NOFORMAT, INIT, NAME = N'DBNAME-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
View mkchmod
#!/bin/bash
#
# (c) 2007 Mattanja Kern <mattanjakern.de>
#
#USAGE="Usage: mkchmod"
USAGE="Usage: mkchmod [dirmode [filemode]]"
if [ "$1" = "" ] ; then
echo $USAGE
View php5-XX-fpm
#!/bin/sh
### BEGIN INIT INFO
# Provides: php-5.3.29-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-5.3.29-fpm
# Description: Starts The PHP FastCGI Process Manager Daemon
### END INIT INFO
View 100percent-height-test.html
<!DOCTYPE html>
<html>
<head>
<link data-require="bootstrap@*" data-semver="3.3.5" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link rel="stylesheet" href="style.css" />
<style>
/*
$color1: #aa0000; //rgba(170, 0, 0, 100)
$color2: #faa916; //rgba(250, 169, 22, 100)
$color3: #fbfffe; //rgba(251, 255, 254, 100)
View boxstarter.txt
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
choco install putty
choco install SublimeText3
choco install 7zip
choco install ruby
choco install TortoiseGit
choco install Cmder
choco install git.install
View SampleController-angular-dialog-service.js
xxx.controller('MyController', ['$scope', 'dialogs', function($scope, dialogs) {
$scope.remove = function() {
dialogs.confirm('Please confirm', 'Are you sure you want to remove this item?')
.result.then(function(btn) {
// Confirmed action
}, function(btn) {
// Cancel action
});
};
}]);
@mattanja
mattanja / Controller.cs
Last active Dec 12, 2015
Typesafe viewmodel for MVC frameworks
View Controller.cs
public abstract class BaseController : Controller {
/// <summary>
/// Setup default page model properties.
/// </summary>
protected ViewBase<TContent> GetDefaultModel<TContent>(ViewBase<TContent> model = null) where TContent : ContentBase
{
if (model == null)
{
model = new ViewBase<TContent>();
}
@mattanja
mattanja / MyServiceTest.cs
Created Oct 16, 2012
Using log4net TestContextAppender
View MyServiceTest.cs
namespace MyTests
{
[TestClass()]
public class IParameterServiceTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
You can’t perform that action at this time.