Skip to content

Instantly share code, notes, and snippets.

View grenade's full-sized avatar

rob thijssen grenade

View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@Pathoschild
Pathoschild / generate-git-tfs-author-file.cs
Created February 18, 2013 15:52
A small console app that generates a git-tfs author file for users on a TFS server. This is used by the git-tfs bridge to map TFS users to git users when migrating a repository.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.VersionControl.Client;
cat >/etc/profile.d/git.sh <<'EOF'
source /usr/share/git-core/contrib/completion/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export PS1='\[\033[00;36m\]\u@\h\[\033[00m\]:\[\033[01;34m\] \w\[\033[00m\]$(__git_ps1 " (%s)")\$ '
EOF
@grenade
grenade / sane-gnome-settings.sh
Last active February 4, 2024 08:11
my personal gnome and fedora setup preferences
# Sane settings for Gnome
gsettings set org.gnome.desktop.background show-desktop-icons true
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'grayscale'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0'
gsettings set org.gnome.desktop.interface monospace-font-name "Monospace 10"
gsettings set org.gnome.desktop.interface document-font-name 'Sans 10'
gsettings set org.gnome.desktop.interface font-name 'Cantarell 10'
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
@piers7
piers7 / Load-TeamCityProperties.ps1
Created September 4, 2013 05:12
Load TeamCity system properties into PowerShell variable scope
<#
.Synopsis
Loads TeamCity system build properties into the current scope
Unless forced, doesn't do anything if not running under TeamCity
#>
param(
$prefix = 'TeamCity.',
$file = $env:TEAMCITY_BUILD_PROPERTIES_FILE + ".xml",
[switch] $inTeamCity = (![String]::IsNullOrEmpty($env:TEAMCITY_VERSION))
)
@simonewebdesign
simonewebdesign / install_sublime_text.sh
Last active March 11, 2024 12:23
Install Sublime Text 3 on Linux via POSIX shell script - http://simonewebdesign.it/install-sublime-text-3-on-linux/
#!/bin/sh
# Sublime Text 3 Install (last update: Monday 13 March 2017)
#
# No need to download this script, just run it on your terminal:
#
# curl -L git.io/sublimetext | sh
# Detect the architecture
@woods
woods / gen-key-script
Last active October 31, 2024 23:23
Creating gpg keys non-interactively
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: [email protected]
Expire-Date: 0
@weberste
weberste / gist:354a3f0a9ea58e0ea0de
Last active January 28, 2022 13:47
Dates only with Angular-UI Bootstrap datepicker
app.directive('datepickerLocaldate', ['$parse', function ($parse) {
var directive = {
restrict: 'A',
require: ['ngModel'],
link: link
};
return directive;
function link(scope, element, attr, ctrls) {
var ngModelController = ctrls[0];
@kostix
kostix / impersonate.go
Created September 30, 2014 16:46
A demonstration example for http://stackoverflow.com/a/26124494
// A demonstration example for http://stackoverflow.com/a/26124494
// It runs a goroutine locked to an OS thread on Windows
// then impersonates that thread as another user using its name
// and plaintext password, then reverts to the default security
// context before detaching from its OS thread.
package main
import (
"log"
"runtime"
@harlow
harlow / worker-pool.go
Last active July 15, 2024 07:55
Worker pool to control concurrency and collect results
package main
import (
"fmt"
"sync"
"time"
)
const concurrency = 3