Skip to content

Instantly share code, notes, and snippets.

@dcreager
dcreager / version.py
Created February 10, 2010 20:30
Extract a setuptools version from the git repository
# -*- coding: utf-8 -*-
# Author: Douglas Creager <dcreager@dcreager.net>
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy of a release tarball,
# rather than in a git working copy), then we fall back on reading the
# contents of the RELEASE-VERSION file.
@AArnott
AArnott / WaitHandlerAwaitable.cs
Created July 15, 2011 15:55
C# 5 Awaitable WaitHandle
public static class AwaitExtensions
{
/// <summary>
/// Provides await functionality for ordinary <see cref="WaitHandle"/>s.
/// </summary>
/// <param name="handle">The handle to wait on.</param>
/// <returns>The awaiter.</returns>
public static TaskAwaiter GetAwaiter(this WaitHandle handle)
{
Contract.Requires<ArgumentNullException>(handle != null);
@epicserve
epicserve / svn_to_git.rst
Created September 15, 2011 17:17
Convert SVN Repositories to Git Repositories

Convert SVN Repositories to Git Repositories

This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.

1. Retrieve a list of all Subversion committers

@stevez
stevez / gist:2305629
Created April 4, 2012 21:02
groovy_request_jira_issue
import groovy.json.JsonSlurper
/*
def urlRoot = "https://example.com"
def issueId = ""
def userName = ""
def password = ""
def addr = "${urlRoot}/rest/api/2/issue/${issueId}"
def authString = "${userName}:${password}".getBytes().encodeBase64().toString()
*/
@jlmonteiro
jlmonteiro / pre-commit-hook.groovy
Created September 10, 2012 18:16
pre-commit-hook
/**
* User: jorge.monteiro
* Date: 02/08/12
* Time: 09:52
*/
@Grapes([
@Grab(group = 'org.tmatesoft.svnkit', module = 'svnkit', version = '1.7.5'),
@Grab(group='log4j', module='log4j', version='1.2.17')
])
private static void CopyFile(string source, string destination, int bytesPerChunk)
{
int bytesRead = 0;
using (FileStream fs = new FileStream(source, FileMode.Open, FileAccess.Read))
{
using (BinaryReader br = new BinaryReader(fs))
{
using (FileStream fsDest = new FileStream(destination, FileMode.Create))
{
@schakko
schakko / check_microsoft_windows_software_raid.ps1
Last active July 10, 2024 09:37
A simple PowerShell script for retrieving the RAID status of volumes with help of diskpart. The nicer solution would be using WMI (which does not contain the RAID status in the Status field of Win32_DiskDrive, Win32_LogicalDisk or Win32_Volume for unknown reason) or using the new PowerShell API introduced with Windows 8 (wrong target system as o…
# A simple PowerShell script for retrieving the RAID status of volumes with help of diskpart.
# The nicer solution would be using WMI (which does not contain the RAID status in the Status field of Win32_DiskDrive, Win32_LogicalDisk or Win32_Volume for unknown reason)
# or using the new PowerShell API introduced with Windows 8 (wrong target system as our customer uses a Windows 7 architecture).
#
# diskpart requires administrative privileges so this script must be executed under an administrative account if it is executed standalone.
# check_mk has this privileges and therefore this script must only be copied to your check_mk/plugins directory and you are done.
#
# Christopher Klein <ckl[at]neos-it[dot]de>
# This script is distributed under the GPL v2 license.
@magnetikonline
magnetikonline / README.md
Last active November 22, 2018 15:05
Subversion (SVN) to Git repository conversion notes.
@stefanhoth
stefanhoth / android-libs.md
Last active April 18, 2020 05:02
GDG Android in Berlin brainstorming session Collection of libraries that should be included as of today in a modern Android app-

#GDG Android in Berlin brainstorming session


On November 27, 2013 I was asking the brilliant Android developers at GDG Android in Berlin for their favorite libraries that make their lives easier and should be included in every newly developed app.

This is the list of libraries we collected during this 10 minute session.

Architecture

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote