Skip to content

Instantly share code, notes, and snippets.

View kardolus's full-sized avatar
🔥
crushing it

Guillermo Kardolus kardolus

🔥
crushing it
View GitHub Profile
public ByteString encrypt(ByteString input){
System.out.println("Encrypting...");
try {
Object lunaSlotManager = Class.forName("com.safenetinc.luna.LunaSlotManager").getDeclaredMethod("getInstance").invoke(null);
lunaSlotManager.getClass().getMethod("login", String.class, String.class).invoke(lunaSlotManager, PARITION_NAME, PARITION_PASSWORD);
Provider provider = (Provider) Class.forName("com.safenetinc.luna.provider.LunaProvider").newInstance();
Security.addProvider(provider);
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", provider);
if [ "$#" -ne 2 ]; then
echo "Usage: bump_version <version_number> <message>"
exit 1
fi
VERSION=$1
MESSAGE=$2
# Update package.json
sed -i '' "s/\"version\": \"[[:digit:]]*.[[:digit:]]*.[[:digit:]]*\"/\"version\": \"${VERSION}\"/g" package.json
if [ -z "$1" ]
then
echo "Usage: create_credentials.sh <number_of_credentials>"
exit 1
fi
for i in `seq 1 $1`;
do
name=$(openssl rand -base64 32 | tr -d /=+ | cut -c -16)
credhub generate -t password -n $name
@kardolus
kardolus / bst.java
Created September 18, 2017 12:21
BST
import java.io.*;
import java.util.*;
class Solution {
public static void main(String... args){
System.out.println("Coding a Binary Search Tree");
int[] original = {100, 113, 110, 85, 105, 102, 86, 63, 81, 101, 94, 106,
101, 79, 94, 90, 97};
@kardolus
kardolus / Sorting Algorithms
Last active September 18, 2017 22:32
Sorting in Java
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] args) {
int[] original = {100, 113, 110, 85, 105, 102, 86, 63, 81, 101, 94, 106,
101, 79, 94, 90, 97};
int[] input = null;
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] args) {
Test test = new Test();
test.runTests();
}
}
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] args) {
Test test = new Test();
test.runTests();
}
}
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] args) {
Test test = new Test();
test.runTests();
}
}
@kardolus
kardolus / Set.java
Last active February 24, 2016 17:33
Implementation of a Set with an array.
package us.kardol.datastructure;
/**
* Created by Guillermo Kardolus on 2/24/16.
*/
public class Set {
private int size = 0;
private int capacity = 4;
private Object[] elements = new Object[capacity];