Skip to content

Instantly share code, notes, and snippets.

View lapo-luchini's full-sized avatar

Lapo Luchini lapo-luchini

View GitHub Profile
From c7c0b49be9e272aa6421ed26f7b03d3c465d2313 Mon Sep 17 00:00:00 2001
From: Rasmus Andersson <rasmus@notion.se>
Date: Tue, 2 Mar 2010 03:13:41 +0100
Subject: [PATCH] Added fs.mkdirs and fs.mkdirsSync for recursively creating directories as needed
---
doc/api.txt | 10 +++++
lib/fs.js | 82 +++++++++++++++++++++++++++++++++++++++++
test/simple/test-fs-mkdirs.js | 47 +++++++++++++++++++++++
3 files changed, 139 insertions(+), 0 deletions(-)
@mathiasbynens
mathiasbynens / change-favicon.js
Created June 7, 2010 12:41
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
@samuellb
samuellb / brainpool_named_curves.diff
Created December 14, 2010 15:49
Support for Brainpool NamedCurves in OpenJDK7
diff --git a/src/share/classes/sun/security/ec/NamedCurve.java b/src/share/classes/sun/security/ec/NamedCurve.java
--- a/src/share/classes/sun/security/ec/NamedCurve.java
+++ b/src/share/classes/sun/security/ec/NamedCurve.java
@@ -658,6 +658,133 @@
0xFF70);
*/
+ /* Brainpool curves (RFC 5639) */
+ add("brainpoolP160r1", "1.3.36.3.3.2.8.1.1.1", P,
+ "E95E4A5F737059DC60DFC7AD95B3D8139515620F",
@jonatasnona
jonatasnona / key-fingerprint
Created March 7, 2012 18:45 — forked from yosemitebandit/key-fingerprint
SSH: print ssh public key's fingerprint
$ ssh-keygen -l -f id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
@orip
orip / GsonHelper.java
Created September 5, 2012 11:22
Gson type adapter to serialize and deserialize byte arrays in base64
import java.lang.reflect.Type;
import android.util.Base64;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
@plentz
plentz / nginx.conf
Last active July 25, 2024 09:38
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@nogweii
nogweii / Test.java
Created October 1, 2013 23:39
A quick test to see if you have the JCE Unlimited Strength Jurisdiction Policy files installed. If you don't, in Java 6 you'll see 128. If you do, you'll see 2147483647. Thanks to http://stackoverflow.com/questions/11538746/check-for-jce-unlimited-strength-jurisdiction-policy-files
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
System.out.println("Hello World!");
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
System.out.println(maxKeyLen);
} catch (Exception e){
System.out.println("Sad world :(");
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.net.ssl.SSLServerSocketFactory;
/*
* Source from Christopher Schultz
* @see http://markmail.org/message/zn4namfhypyxum23
*/
public class SSLInfo
@bnyeggen
bnyeggen / MMapper.java
Last active May 31, 2021 12:06
Mmap more than 2GB of a file in Java
import java.io.RandomAccessFile;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.channels.FileChannel;
import sun.nio.ch.FileChannelImpl;
import sun.misc.Unsafe;
@SuppressWarnings("restriction")
public class MMapper {
@lummie
lummie / gist:732b8cb0b478966b91a7f9244c7aeac7
Last active December 12, 2021 20:20
Change exif timezone with exiftool -8 hour
// I'm forever forgetting to adjust the time zone on my camera when taking pictures on vacation
// this uses the linux exiftool to adjust the timezone -8 hours for all images in a directory
exiftool "-DateTimeOriginal-=0:0:0 8:0:0" *