Skip to content

Instantly share code, notes, and snippets.

View budhash's full-sized avatar

Budhaditya budhash

  • San Francisco Bay Area
View GitHub Profile
@budhash
budhash / NapkinTax.py
Created November 10, 2023 06:16
NapkinTax
import json
class Income:
def __init__(self):
self.income_sources = {}
def add(self, source, amount):
"""Add income to the total, categorizing by source."""
self.income_sources[source] = self.income_sources.get(source, 0) + amount
https://github.com/ripienaar/free-for-dev
https://github.com/akullpp/awesome-java
@budhash
budhash / List 2 Pairs
Created September 23, 2016 03:45 — forked from ktejnora/List 2 Pairs
Java 8 Create list of pairs from List of items. Java does not have Pair and groupBy uses AtomicInteger trick.
package cz.tejnora.pokusy;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
package com.budhash.common.utils;
//import com.github.drapostolos.typeparser.TypeParser;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
public class Converter {
@budhash
budhash / Country.java
Last active September 29, 2023 16:10
countries csv file
package com.budhash.common.location;
import com.budhash.common.utils.Converter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
#!/bin/bash
set -e
UPDATES_URL="http://updates.jenkins-ci.org/download/plugins/"
if [ $# -lt 2 ]; then
echo "USAGE: $0 plugin-list-file destination-directory"
exit 1
fi
@budhash
budhash / Non-Blocking Guava Cache
Last active March 21, 2016 09:49 — forked from theotherian/ Non-Blocking Guava Cache
Blocking on cache reads beyond the first is just plain rude in my opinion, so refresh in the background.
http://www.theotherian.com/2013/11/non-blocking-cache-with-guava-and-listenable-futures.html
@budhash
budhash / Atomic.java
Created March 7, 2016 19:49
A small toolkit of classes that support lock-free thread-safe programming on single records
/*
* Copyright (c) 2012 Jan Kotek
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@budhash
budhash / SSLTrustAll
Created October 19, 2015 20:37
SSLTrustAll - Apache HTTP Client
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
@budhash
budhash / idea.vmoptions
Created October 12, 2015 18:17
~/Library/Preferences/IntelliJIdea14/idea.vmoptions
-server
-Xms1g
-Xmx3g
-Xss16m
-XX:MaxPermSize=350m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=225m
-XX:+AlwaysPreTouch