Skip to content

Instantly share code, notes, and snippets.

View mondain's full-sized avatar
🏠
Working from home

Paul Gregoire mondain

🏠
Working from home
View GitHub Profile
#!/bin/sh
#
# Downloads and installs the startssl CA certs into the global java keystore
# Author: Klaus Reimer <k@ailis.de>
#
# Check if JAVA_HOME is set
if [ "$JAVA_HOME" = "" ]
then
echo "ERROR: JAVA_HOME must be set."
import org.apache.tools.ant.taskdefs.condition.Os
def getPlatformNdkBuildCommand() {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream {
instr -> properties.load(instr)
}
@stephanetimmermans
stephanetimmermans / ubuntu-hipchat
Created July 3, 2014 09:29
Install hipChat on Ubuntu 14.04
sudo su
echo "deb http://downloads.hipchat.com/linux/apt stable main" > \ /etc/apt/sources.list.d/atlassian-hipchat.list
wget -O - https://www.hipchat.com/keys/hipchat-linux.key | apt-key add -
apt-get update
apt-get install hipchat
@joa
joa / StackBlur.java
Last active February 20, 2018 12:28
Stackblur algorithm by Mario Klingemann (http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html) Based on C++ implementation by Victor Laskin (http://vitiy.info/stackblur-algorithm-multi-threaded-blur-for-cpp/)
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
*
*/
public final class StackBlur {
private static final int PARALLEL_THRESHOLD = 2048 * 2048;
anonymous
anonymous / ERC20.sol
Created January 12, 2018 01:51
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
pragma solidity ^0.4.10;
interface ERC20 {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
@cryptolok
cryptolok / randomGenVideo.sh
Last active November 3, 2019 19:47
WebCam video-based pseudo-random number generator
#!/bin/bash
# poor-man's quantum photon detector randomizer
# ~1kb/s
# over a test of a thousand time, global entropy was equal to 7.99/8 and passed nearly all Dieharder tests, as well as FIPS 140-2
# however, sigma, mean and chi-square stats aren't too much enthusiastic
# overall, the result is pretty impressive, but of course, don't use it in production :)
DEVICE=/dev/video0
# for external cameras should be /dev/video1
@avilches
avilches / Sha.java
Created December 21, 2010 16:25
How to encode a hex SHA256 in Java
import java.security.*;
public class Sha {
public static String hash256(String data) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(data.getBytes());
return bytesToHex(md.digest());
}
public static String bytesToHex(byte[] bytes) {
StringBuffer result = new StringBuffer();
for (byte byt : bytes) result.append(Integer.toString((byt & 0xff) + 0x100, 16).substring(1));
package com.eclipsesource.j2v8.tutorial;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.ByteBuffer;
import com.eclipsesource.v8.NodeJS;
import com.eclipsesource.v8.Releasable;
import com.eclipsesource.v8.V8Array;
@SandroMachado
SandroMachado / convert-to-webp.sh
Last active January 13, 2021 01:11
Script to convert all the `JPEG` images to the `WEBP` format in your Android project
#/bin/sh
# Inpiration: http://engineeringblog.yelp.com/2016/05/yelp-android-app-went-on-a-diet.html
# `-lossless` not used to give support for Android 4.0+
# Make sure cwebp is installed.
if ! type "cwebp" > /dev/null; then
echo "Please install cwebp to continue:"
echo "brew install webp"
exit 1
fi
@passionne
passionne / UpdateJavaLibPath.java
Created August 6, 2015 14:10
update java library path programmatically
import java.lang.ClassLoader;
import java.lang.String;
import java.lang.System;
import java.lang.reflect.Field;
class UpdateJavaLibPath {
public static String printLibPath() {
String current = System.getProperty("java.library.path");
System.out.println(String.format("current = %s", current));