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
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@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));
@bricef
bricef / AES.c
Last active March 4, 2023 11:29
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
#!/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."
@eevee
eevee / spabs.md
Last active February 20, 2024 08:29
tabs to spaces
@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;
@deandob
deandob / livestream
Created February 26, 2014 22:31
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@ibc
ibc / Chrome.sh
Last active February 26, 2024 17:52
WebRTC debugging
/Google\ Chrome\ Canary --enable-logging --v=1 --vmodule=*/webrtc/*=2,*/libjingle/*=2,*=-2 --enable-logging=stderr
// Easier:
/Google\ Chrome\ Canary --enable-logging --v=1 --vmodule=*/webrtc/*=2,*=-2 --enable-logging=stderr
@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
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"