Skip to content

Instantly share code, notes, and snippets.

View moust's full-sized avatar

Quentin Aupetit moust

  • ReachFive
  • Guadeloupe, France
View GitHub Profile
@moust
moust / Sample.java
Last active November 12, 2019 04:34
Example of implementation of APK Expansion Files download process with a PhoneGap application
package com.phonegap.Sample;
import java.io.File;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
@moust
moust / escapestring.js
Last active August 29, 2015 14:01
JavaScript escapeString function
var escape = {
"&": "&",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
var badChars = /[&<>"'`]/g;
@moust
moust / bootstrap.php
Last active August 29, 2015 14:16
Google Calendar API connection with private key file
require_once 'vendor/google-api-php-client/src/Google/autoload.php';
// email address from the client
$serviceAccountName = '####################@developer.gserviceaccount.com';
$scopes = array(
'https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/calendar.readonly'
);
@moust
moust / setup-ap.sh
Last active September 28, 2016 06:55
Setup AP network with local dns routing on RaspberryPi
#!/bin/bash
if [[ "$EUID" -ne 0 ]]; then
echo -e "\e[31mPlease run as root\e[0m"
exit 1
fi
read -p "Please provide your new SSID: " SSID
read -p "Please provide your new AP network (i.e. 192.168.1.X). Remember to put X at the end!!! " NETWORK
@moust
moust / ffmpeg-install.sh
Last active August 29, 2015 14:19
FFmpeg install script for OS X
#!/bin/bash
# Any subsequent commands which fail will cause the shell script to exit immediately
set -e
# OS version
OS_Version=$(sw_vers -productVersion)
# install homebrew if not already installed
if hash brew 2>/dev/null; then
@moust
moust / oscilloscope.html
Created June 24, 2015 14:52
Oscilloscope using Web Audio API
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Oscilloscope</title>
<style type="text/css">
.visualizer {
display: block;
width: 100%;
height: auto;
@moust
moust / spectrogram.html
Created June 24, 2015 14:53
Spectrogram using Web Audio API
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Spectrogram</title>
<style type="text/css">
.visualizer {
display: block;
background-color: black;
}
@moust
moust / preload.html
Last active August 29, 2015 14:23
JavaScript Preloader
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Preload</title>
</head>
<body>
<progress id="loading" value="0"></progress>
<script src="preload.js"></script>
<script>
@moust
moust / OptimizerSpec.scala
Created April 24, 2019 10:20
Spark unit test context
class OptimizerSpec extends FlatSpec with Matchers with SparkSetup {
"solve" should "work with just intercept" in withSparkSession { session =>
...
}
}
import atto.Atto._
import atto.Parser
import io.circe.optics.JsonPath
import io.circe.optics.JsonPath.root
import scala.annotation.tailrec
import scala.util.Try
object JsonPointer {