Skip to content

Instantly share code, notes, and snippets.

View LouDnl's full-sized avatar

LouD LouDnl

View GitHub Profile
@Spaceghost
Spaceghost / DecryptWindowsProductKey.py
Created March 19, 2011 01:06
A script to decrypt windows product keys written in python
import _winreg
def DecodeKey(rpk):
rpkOffset = 52
i = 28
szPossibleChars = "BCDFGHJKMPQRTVWXY2346789"
szProductKey = ""
while i >= 0:
dwAccumulator = 0
@adamvr
adamvr / extract-uimage.sh
Created July 13, 2011 05:20
Script for extracting a uimage
#!/bin/sh
#
# Copyright (C) 2010 Matthias Buecher (http://www.maddes.net/)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/gpl-2.0.txt
#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck <enck@cse.psu.edu>
# Description : Split appart an Android boot image created
# with mkbootimg. The format can be found in
# android-src/system/core/mkbootimg/bootimg.h
#
# Thanks to alansj on xda-developers.com for
@bkersten
bkersten / gist:1388295
Created November 23, 2011 09:45
select-vals returns a list of map values in the order of the supplied key sequence
(defn select-vals [map keyseq]
"Returns a list containing the entries in map whose key is in keys, in order of the supplied keys, with nil in place of keys not found"
(loop [ret [] keys (seq keyseq)]
(if keys
(let [value (first (rest (. clojure.lang.RT (find map (first keys)))))]
(recur
(if value
(conj ret value)
(conj ret nil))
(next keys)))
@alexeds
alexeds / move-stashes.md
Created September 5, 2012 18:00
Move your stashes from one repo to another

Move your stashes from one repo to another


This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

@rboyd
rboyd / random-str.clj
Created February 28, 2013 03:30
random string (clojure)
(defn rand-str [len]
(apply str (take len (repeatedly #(char (+ (rand 26) 65))))))
@dportabella
dportabella / TestJKS.java
Last active January 26, 2024 19:34
Test your JKS file easily with java -Djavax.net.ssl.trustStore=your_trust_store.jks TestJKS <url> [<user> <password>]
/*
Test your JKS file easily.
You have created a java JKS trust store file to access a webservice with a certificate, and you want to test if it works?
Some colleagues often test this by deploying the jks to the application server (tomcat, weblogic...), restarting the server and manually running tests,
and repeating this procedure until the jks is properly created.
you can speed up this test by using this simple java program:
> javac TestJKS.java
@egamble
egamble / private.clj
Last active May 16, 2023 12:41
Two ways to call private methods in Clojure.
;; This fn allows calling any method, as long as it's the first with that name in getDeclaredMethods().
;; Works even when the arguments are primitive types.
(defn call-method
[obj method-name & args]
(let [m (first (filter (fn [x] (.. x getName (equals method-name)))
(.. obj getClass getDeclaredMethods)))]
(. m (setAccessible true))
(. m (invoke obj (into-array Object args)))))
@iainsproat
iainsproat / gist:8378720
Created January 12, 2014 00:11
Git: stash work in progress and move it to a new branch
  • make changes
  • git stash save
  • git checkout -b xxx
  • git stash pop

where xxx is the new branch name

@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences