Skip to content

Instantly share code, notes, and snippets.

@ilkerde
ilkerde / rexif.sh
Created November 9, 2014 14:10
REXIF - Fix EXIF data based on file name
#!/bin/bash
files="*.jpg"
regex="IMG_([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{2})([0-9]{2})([0-9]{2}).*"
for f in $files; do
[[ $f =~ $regex ]]
y="${BASH_REMATCH[1]}"
m="${BASH_REMATCH[2]}"
d="${BASH_REMATCH[3]}"
@ilkerde
ilkerde / make.ps1
Last active August 29, 2015 14:02
Psake-Selfboot-Nuget
param (
[string[]] $TaskListPsake = @(),
[string] $FrameworkPsake = '4.0',
[switch] $DocsPsake = $false,
[hashtable] $ParametersPsake = @{},
[hashtable] $PropertiesPsake = @{}
)
$main = -not $MyInvocation.PSScriptRoot
$root = $PSScriptRoot
@ilkerde
ilkerde / goutf8.sh
Created May 19, 2014 19:44
Convert Latin1 to UTF8 in CLI
find . -type f -iname *.html -exec file --mime-encoding {} \; | grep -Z iso-8859-1 | sed 's/: iso-8859-1//g' | xargs -i{} sh -c 'iconv -f iso-8859-1 -t utf-8 -o "{}".utf8 "{}";mv -f "{}".utf8 "{}";'
@ilkerde
ilkerde / MvcTagBuilderIsNotXHTMLCompliant.cs
Created July 20, 2013 20:38
Sort of picky thing, I know.
namespace MvcTagBuilderIsNotXHTMLCompliant
{
using System.Collections.Generic;
using System.Web.Mvc;
using System.Xml.Linq;
using NUnit.Framework;
[TestFixture]
public class MvcTagBuilderXHTMLCompliancyTest
@ilkerde
ilkerde / jshplay.js
Created March 17, 2012 09:36
A spike on jsh...
var jLog = (function($){
var log = {
info: function(s){
s = s || "";
this.isReady && this.write(s);
this.isReady || this.messageQueue.push(s);
return true;
},
log: function(s){
@ilkerde
ilkerde / gist:1899961
Created February 24, 2012 10:18
A very poor "grep" with PowerShell :-)
function pscan($s,$w) { ls * -i -r $w | %{$f=$_;$l=0;cat $f | %{$l++;$_;} | ?{$_ -imatch $s} | %{"[$l] $f: $_"}}}
@ilkerde
ilkerde / Boom.txt
Created February 16, 2012 12:52
An unsuccessful attempt to initialize nancy with module instances.
Unhandled Exception: TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRouteResolver ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.RouteCache ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.ModuleInstanceTest.MyModule ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.String ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Char[] ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Int32
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.N
@ilkerde
ilkerde / EmitBit.cs
Created February 9, 2012 19:23
Func<dynamic,bool> interplay between C# and F#
namespace FuncTest {
using System;
public class EmitBit {
public Func<dynamic,bool> Emitter { get; set; }
public void Emit() {
Console.WriteLine("emit was {0}", Emitter("test"));
}
}
}
@ilkerde
ilkerde / flex.fs
Created February 2, 2012 10:45
FSharp Flexibility
// A case for FSharp: Flexibility Applied
// --------------------------------------
//
// Consider a Where expression in C#
// nums.Where(x => 0 <= x); //yoda-esque
//
// Let's see F# doing this.
let nums = [-2 .. 2];;
@ilkerde
ilkerde / shdump
Created January 15, 2012 17:08
Missing AddToObservable while building FAKE with FAKE using Mono
[ilker@x fake]$ mono build/FAKE.exe build.fsx
Missing method Microsoft.FSharp.Control.CommonExtensions::AddToObservable<[1]>(IObservable`1<!!0>,FSharpFunc`2<!!0, Unit>) in assembly /usr/local/lib/mono/gac/FSharp.Core/2.0.0.0__b03f5f7f11d50a3a/FSharp.Core.dll, referenced in assembly /home/ilker/Code/fake/build/FakeLib.dll