Skip to content

Instantly share code, notes, and snippets.

View jarrodhroberson's full-sized avatar

Jarrod Roberson jarrodhroberson

View GitHub Profile
/**
* Current standard is RFC 3986, published in 2005: http://tools.ietf.org/html/rfc3986#page-50. Apache Commons has a
* url validator, but it doesn't accept certain urls, probably because it's implementing RFC2396 from 1998. Also, the
* Fitbit API validator has custom needs such as allowing unicode characters.
* <p/>
* REGEX_COMPILED is used by UrlTypeConverter and MultiUrlsTypeConverter to validate third party app urls.
* <p/>
* All regex parts are borrowed from dperini's "https://gist.github.com/dperini/729294" unless otherwise noted.
* The dperini regex satisfies most of the test cases here: https://mathiasbynens.be/demo/url-regex, and has undergone
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active May 6, 2024 16:55
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete
@dopoljak
dopoljak / CertificateSigningRequestUsingSunJDK.java
Last active August 28, 2023 13:56
Example how to create PKCS#10 Certificate Signing Request (CSR) using Sun JDK, This example creates signature externally - suitable for Cryptographic devices such as Hardware Security Module (HSM)
package com.ilirium.client;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import com.google.common.reflect.TypeToken;
@SuppressWarnings("unchecked")
public T get()
{
final Class<T> entityType = (Class<T>) new TypeToken<T>(getClass()) {}.getRawType();
try { return entityType.newInstance(); }
catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); }
}
@amoilanen
amoilanen / bulk_download_Coursera_videos.js
Last active May 21, 2022 02:18
Bulk download of Coursera videos with wget
/*
* Bulk download of Coursera videos with wget.
*
* Copyright (c) 2014 Anton Ivanov anton.al.ivanov@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@jarrodhroberson
jarrodhroberson / find_in_jar.bat
Last active November 16, 2017 00:50 — forked from leogomes/find_in_jar.sh
bash and windows shell scripts to find classes in .jar files in a directory
# Windows (cmd) Command line version
forfiles /S /M *.jar /C "cmd /c jar -tvf @file | findstr /C:"$1" && echo @path"
@VijayKrishna
VijayKrishna / ReturnAdapter.java
Last active September 8, 2023 19:53
Example code showing how the AdviceAdapter in ASM(.ow2.org) can be used/extended.
package self.vpalepu.stackoverflow;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
@jhoff
jhoff / md5.js
Created November 27, 2013 18:27
Closure of Joseph's Myers md5 javascript implementation
/*
* http://www.myersdaily.org/joseph/javascript/md5-text.html
*/
(function() {
var md5cycle = function(x, k) {
var a = x[0], b = x[1], c = x[2], d = x[3];
a = ff(a, b, c, d, k[0], 7, -680876936);
@valerysntx
valerysntx / underscore.uuid.js
Last active December 17, 2015 13:49
client javascript uuid v4 and v5 generator. do not require additional libs. adopted from 'superscore' extensions by David Souther. http://davidsouther.github.com/superscore/ usage: var randomUUID = underscore.UUID.v4(); var uuidv5 = underscore.UUID.v5(msg,namespace);
var underscore = (function(underscore){
// Build several namespaces, globally...
var UUID = {};
var Sha1 = function(str){return Sha1.hash(str, true);};
var Utf8 = {};
var extend = function() {
var options, name, src, copy, copyIsArray, clone,
@ophentis
ophentis / gist:5473449
Created April 27, 2013 15:16
setting multiple private key for ssh
1.
ssh-keygen -t rsa -f ~/.ssh/id_rsa.work -C "Key for Word stuff"
2.
touch ~/.ssh/config
chmod 600 ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.work" >> ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.misc" >> ~/.ssh/config