Skip to content

Instantly share code, notes, and snippets.

View jarrodhroberson's full-sized avatar

Jarrod Roberson jarrodhroberson

View GitHub Profile
@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
@diegum
diegum / bitset_iter.h
Last active May 1, 2024 22:10
Missed an iterator for C++ STL bitset? Have mine!
// bitset_iter.h v1.1.0
// Copyright 2019, Diego Dagum
//
// 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
// furnished to do so, subject to the following conditions:
//
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@thomaspoignant
thomaspoignant / Makefile
Last active April 30, 2024 10:55
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
@yincrash
yincrash / Google2APi.java
Created April 22, 2012 17:22
Google OAuth2.0 for scribe-java
package org.scribe.builder.api;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.scribe.exceptions.OAuthException;
import org.scribe.extractors.AccessTokenExtractor;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
@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;
@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;
@vinnyoodles
vinnyoodles / kmp.java
Created December 30, 2016 22:30
Knuth Morris Pratt string searching algorithm in Java
import java.util.Scanner;
public class KMP {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
String search = kb.next();
String target = kb.next();
int result = KMP(search, target);
if (result == -1) {
System.out.println("NO");
@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);
@gclaramunt
gclaramunt / Event.java
Created March 28, 2012 18:13
Fluent state machine in Java
package statemachine;
public class Event {
final private String label;
public Event(String newLabel) {
label = newLabel;
}
/**