Skip to content

Instantly share code, notes, and snippets.

View jskripsky's full-sized avatar

Juraj Skripsky jskripsky

  • Zurich, Switzerland
View GitHub Profile
@jskripsky
jskripsky / rem-color-profiles.sh
Created October 13, 2011 10:50
GraphicsMagick: remove color profile(s)
mogrify +profile '*' -define jpeg:preserve-settings
@jskripsky
jskripsky / BigIntSqrt.fs
Created October 11, 2011 10:07
Square root for BigInteger in F# (taken from http://www.codeproject.com/KB/recipes/BigIntSqrRoot.aspx)
module Roots
open System
open System.Numerics
@jskripsky
jskripsky / ilist-test.aspx
Created September 19, 2011 14:41
More tests as ASP.NET script.
<script runat="server">
enum Set {
One = 1,
Two = 2
}
enum ItemOne {
One = 1
}
@jskripsky
jskripsky / mono-bug.txt
Created September 18, 2011 22:02
Possible mono bug: IList.Contains does automatic/implcit conversion between enums (or casts to int).
using System;
using System.Collections;
using System.Collections.Generic;
namespace Test {
enum Set {
One = 1,
Two = 2,
Three = 3
}
@jskripsky
jskripsky / static_copy.sh
Created August 31, 2011 00:08
Create static website copy
#!/bin/bash
wget \
--restrict-file-names=windows \
--html-extension \
--convert-links \
--page-requisites \
--recursive \
--no-host-directories \
--exclude-directories=UserData,UserData/generated \
@jskripsky
jskripsky / GetFields.cs
Created August 12, 2011 09:58
Get all fields (following inheritance chain) using Chain<T>(Func<T, T>) extension method.
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
static class Helper {
public static IEnumerable<T> Chain<T>(this T first, Func<T, T> follow) where T : class {
for (T item = first; item != null; item = follow(item))
yield return item;
}
@jskripsky
jskripsky / clean-seo-history.sh
Created July 3, 2011 20:00
Git invocations to clean up SEO report history
#!/bin/bash
git filter-branch --force --prune-empty --tree-filter "sort pageranks.txt -o pageranks.txt || true {} \;"
git filter-branch --force --prune-empty --tree-filter "find -name "*.xml" -exec sed -i -e 's/us-ascii/utf-8/' {} \;"
#if [ -e pageranks.txtx ]; then echo "ok"; fi
@jskripsky
jskripsky / bluefish-replace-regex.txt
Created April 11, 2011 13:34
Replace with regex in Bluefish
^Funktion: (.*?)\n
<function>\1</function>\n
- Regex style: PERL
- Allow escaped chars
@jskripsky
jskripsky / sumOfSquares.fs
Created March 10, 2011 16:21
Sum of Squares in F#: imperative, pure functional, native
let sqr x = x * x
let sumOfSquaresI nums =
let mutable acc = 0.0
for x in nums do
acc <- acc + sqr x
acc
let rec sumOfSquaresF nums =
match nums with
@jskripsky
jskripsky / website-static-copy.sh
Created March 1, 2011 10:38
Create static copy of website
#!/bin/bash
# add "--adjust-extension" to force .html extensions
wget --restrict-file-names=windows --page-requisites --convert-links --recursive http://www.website.ch