Skip to content

Instantly share code, notes, and snippets.

@janeczku
janeczku / dnsexit.sh
Last active September 24, 2023 20:17
A custom module to use DDNS provider "DNSexit.com" with Synology's DDNS update service
#!/bin/sh
# dnsexit.sh - A DnsExit.com DDNS custom module for Synology DSM
#
# Author:
# Brian Schmidt Pedersen (http://blog.briped.net)
#
# Version:
# 1.3.5
@WilHall
WilHall / WebpageThumbnailsInPython.md
Created November 29, 2013 00:45
Webpage Thumbnails In Python

#Webpage Thumbnails In Python A small WSGI script that uses selenium's headless PhantomJS driver to capture webpage screenshots, and PIL to resize them. Cropping options could easily be added.

##Dependencies

  • Python selenium
  • Python PIL
  • PhantomJS
@mfcollins3
mfcollins3 / GenerateVersionInfo.xml
Created January 24, 2013 16:44
Classes for using semantic version numbers with .NET applications. For more information, see <http://www.michaelfcollins3.me/blog/2013/01/23/semantic_versioning_dotnet.html>.
<!--
The GenerateVersionInfo task will generate the VersionInfo.cs file with the
metadata for the current build.
-->
<UsingTask TaskName="GenerateVersionInfo"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
@jdavidw13
jdavidw13 / gist:2156565
Created March 22, 2012 06:03 — forked from Zirak/gist:1761880
A parser for DnD dice rolls, with support for min/max rolls.
//infix operator-precedence parser
//also supports a d operator - a dice roll
var parsePrecedence = (function () {
//we don't care about whitespace. well, most whitespace
var whitespace = {
' ' : true,
'\t' : true
};
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@TaoK
TaoK / TextFileEncodingDetector.cs
Last active September 10, 2025 12:40
Simple class to automatically detect text file encoding, with English-biased "best guess" heuristic based on byte patterns in the absence of BOM.
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace KlerksSoft
{
public static class TextFileEncodingDetector
{
/*