This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Use this script to test if a given TCP host/port are available | |
WAITFORIT_cmdname=${0##*/} | |
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } | |
usage() | |
{ | |
cat << USAGE >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-id="{gdoc_id}" class="gdoc-embed-wrapper" style="position:relative;width:100%;"> | |
<div style="padding-top: 141%"></div> | |
<script> | |
const parent = document.currentScript.parentElement; | |
const id = parent.dataset.id; | |
const t = "https://docs.google.com/document/d/"+id+"/export?format=pdf"; | |
const loader = document.createElement("DIV"); | |
loader.innerHTML = "Loading document... | |
Object.assign(loader.style, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Use puppeteer with mocha --parallel while keeping just one browser instance | |
// run with `mocha --require puppeteer_hooks.js` | |
// It uses puppetter's connect method to wire test suites to the browser | |
// See : https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#puppeteerconnectoptions | |
//Access the browser in tests using `this.browser` | |
const fs = require('fs').promises; | |
const path = require('path'); | |
const os = require('os'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Install firefox official stable release on debian stretch and consorts | |
set -e | |
TMP="$(mktemp -d)" | |
install_base="/usr/local" | |
echo "downloading latest firefox release..." | |
wget -O "$TMP/FirefoxSetup.tar.bz2" "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=fr" | |
echo "removing old firefox binaries" | |
test -d "$install_base/lib/firefox" && rm -rf "$install_base/lib/firefox" | |
echo "extracting..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <iostream> | |
extern "C"{ | |
#include <libavformat/avformat.h> | |
#include <libavformat/avio.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
#include <libavutil/imgutils.h> //for av_image_alloc only | |
#include <libavutil/opt.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Rough implementation of application/JSOn formData submission https://darobin.github.io/formic/specs/json/ | |
function jsonFromForm(form){ | |
const formdata = new FormData(form); | |
//use iterable property of form.keys() to send JSON | |
const data = {}; | |
for(let key of formdata.keys()){ | |
data[key] = formdata.get(key); | |
} | |
return JSON.stringify(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
IN="$1" | |
TMP=$(mktemp -d) | |
mkdir "$TMP/src" | |
#create our sample videos | |
avconv -f image2 -i "$IN" "$TMP/src/frame-%04d.png" | |
#H.264 profiles | |
avconv -f image2 -i "$IN" -c:v h264 -c:a none -pix_fmt yuv420p -profile:v main -level 31 "$TMP/out.mp4" | |
avconv -f image2 -i "$IN" -c:v h264 -c:a none -pix_fmt yuv420p -profile:v high -level 41 "$TMP/out_h.mp4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# basic deb package building | |
set -e | |
DIR="$( cd "$( dirname "$0" )" && pwd )" | |
NODE_ENV=production | |
VERSION=$(head -1 $DIR/debian/changelog|sed -r 's/.*\(([^\)]*)\).*/\1/') | |
NAME=$(head -1 $DIR/debian/changelog|cut -d " " -f 1) | |
TMP=$(mktemp -d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var read = function(device){ | |
, stream; | |
try { | |
stream = fs.createReadStream(device, { | |
flags: 'r', | |
encoding: null | |
}) | |
.on('data', function(buf){ | |
var i,j,chunk = 24; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UnityListener{ | |
public UnityListener(){ | |
tcpClientConnected = new ManualResetEvent(false); | |
server = new TcpListener(IPAddress.Parse("127.0.0.1"),8080); | |
server.Start(); | |
// Set the event to nonsignaled state. | |
tcpClientConnected.Reset(); | |
Debug.Log("Waiting for a connection..."); | |
server.BeginAcceptTcpClient( | |
new AsyncCallback(DoAcceptTcpClientCallback), server); |
NewerOlder