Skip to content

Instantly share code, notes, and snippets.

@bosmievoll
bosmievoll / ADPasswordEncoder.java
Created November 22, 2011 09:09
Active Directory Password Encoder
package no.smievoll.ad;
import javax.naming.directory.BasicAttribute;
import java.util.List;
public class ADPasswordEncoder {
private static byte[] generatePasswordByteArray(String clearTextPassword) throws UnsupportedEncodingException {
/* NB: AD requires password string to be quoted. */
@cjohansen
cjohansen / gist:1486702
Created December 16, 2011 16:23
Asynchronous Buster.JS tests
// Oops: Defaut test runner timeout is 250ms
buster.testCase("Async stuff", {
"does things asynchonously": function (done) {
setTimeout(function () {
assert(true);
done();
}, 100);
},
@saetia
saetia / gist:1623487
Last active March 19, 2024 15:21
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@smat
smat / pom.xml
Created February 22, 2012 15:49
Commit id in production
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<!-- outputFile doesn't work in the regular v1.2 (see MEXEC-86) -->
<version>1.2.1-BRING</version>
<executions>
<execution>
@lonnen
lonnen / gist:3101795
Created July 12, 2012 23:24
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@4ndrej
4ndrej / SSLPoke.java
Last active January 3, 2024 09:50
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
@sgr
sgr / workaround_the_iconservices_bug_mavericks.sh
Last active July 25, 2020 11:01
When "com.apple.IconServicesAgent" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
#!/bin/sh
mkdir ${TMPDIR}/com.apple.IconServices
@nolanlawson
nolanlawson / completion-for-gradle.md
Last active April 5, 2024 07:43
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@niksumeiko
niksumeiko / git.migrate
Last active April 17, 2024 11:47
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.