Skip to content

Instantly share code, notes, and snippets.

View emilisto's full-sized avatar

Emil Stenqvist emilisto

View GitHub Profile
@emilisto
emilisto / README.md
Last active July 4, 2022 08:32
se-video-pages

Video pages

image

@emilisto
emilisto / feature-toggle.ts
Created August 17, 2021 16:38
feature-toggle.ts
{
const FEATURE_VIDEOPLAYER_WEBCOMPONENT = true
if (!FEATURE_VIDEOPLAYER_WEBCOMPONENT) {
loadWebPackPlayer()
} else {
loadCalicoPlayer()
}
}
function loadWebPackPlayer() {
@emilisto
emilisto / jwconfig-allas.json
Last active April 16, 2021 09:25
jwconfig-dagbladet.json
{
"advertising": {
"admessage": "Videon kommer att spelas om xx sekunder",
"adscheduleid": "RBpAHqAL",
"autoplayadsmuted": true,
"bids": {
"bidders": [
{
"id": "3508774",
"name": "PubMatic",
@emilisto
emilisto / docker-compose.yml
Last active August 29, 2015 14:16
Annoying docker-compose bug
test:
image: ubuntu:precise
command: /bin/sh
@emilisto
emilisto / apt-get-install-docker
Created February 27, 2015 13:43
Wrapper for `apt-get install` that runs apt-get update if any download returns 404
#!/bin/bash
COMMAND="DEBIAN_FRONTEND=noninteractive apt-get install -qy $@"
eval $COMMAND || (apt-get update && eval $COMMAND)
@emilisto
emilisto / timeit_and_print.py
Created December 27, 2014 18:11
Time it and print friendly output
from timeit import timeit
def timeit_and_print(stmt, setup='pass', number=100000):
t = timeit(stmt, setup=setup)
print 'Executed "%s" %d times in %.4f seconds, %.4f ms per call (%d calls per second)' % (
stmt, number, t, 1000 * t / number, int(number / t))
[user]
name = Emil Stenqvist
email = [email protected]
[branch]
autosetuprebase = always
[color]
diff = auto
status = auto
@emilisto
emilisto / segfault.c
Created March 18, 2014 13:34
C99 problem with strdup
/*
* $ gcc -std=c99 -o segfault segfault.c -lpthread
* segfault.c: In function ‘thread_fn’:
* segfault.c:7:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
* segfault.c:7:17: warning: initialization makes pointer from integer without a cast [enabled by default]
* $ ./segfault
* Segmentation fault
*/
#include <stdio.h>
/*
*
* Simple benchmark of `pipe` (https://github.com/wowus/pipe) library
*
* $ gcc -O3 -pthread -o test pipe.c test.c
* $ ./test
* Consuming 2000000 items from the queue...
* Received 2000000 items in 0.52 seconds, average throughput of 3878081 items/s
*
*/
@emilisto
emilisto / generate-certs.sh
Created August 29, 2013 14:17
Script I used to generate an SSL key and sign a certificate for using with a grunt development server.
#!/bin/bash
root_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ssl_dir=$root_dir/ssl
mkdir -p $root_dir/ssl
echo ">> Generating SSL key and certificate..."
rm -rf $ssl_dir/*