Skip to content

Instantly share code, notes, and snippets.

View yoga1290's full-sized avatar

Youssef yoga1290

View GitHub Profile
@jhedstrom
jhedstrom / gist:6125918
Created July 31, 2013 20:36
Running Firefox headless for selenium/Behat tests
if [ ! -f /tmp/.X5-lock ]; then /usr/bin/Xvfb :5 -ac -screen 0 1024x768x8 & fi
export DISPLAY=:5.0 # firefox needs this to know where to find a display to run on
java -jar /opt/selenium/selenium-server-standalone-2.26.0.jar > /dev/null 2>&1 &
@olasd
olasd / stream_to_youtube.sh
Created March 28, 2014 19:58
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active November 4, 2024 04:19
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@phanan
phanan / runner.js
Last active May 8, 2024 08:44
Record a webpage with PhantomJS and FFMpeg
// Run this from the commandline:
// phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
var page = require('webpage').create(),
address = 'http://s.codepen.io/phanan/fullembedgrid/YPLewm?type=embed&safe=true&_t=1424767252279',
duration = 3, // duration of the video, in seconds
framerate = 24, // number of frames per second. 24 is a good value.
counter = 0,
width = 500,
height = 500;
@jdecool
jdecool / behat.yml
Created May 7, 2017 10:39
Use Chrome Headless with Behat
default:
extensions:
Behat\MinkExtension:
base_url: http://localhost:8000
default_session: selenium2
selenium2:
browser: chrome
wd_host: http://127.0.0.1:4444/wd/hub
capabilities:
chrome:
@AnsonT
AnsonT / index.js
Last active September 18, 2023 17:48
Using Node-Jose to for RSA jwt with key store
import { JWE, JWK, JWS } from 'node-jose'
import fs from 'fs'
import { join } from 'path'
import jwkToPem from 'jwk-to-pem'
import jwt from 'jsonwebtoken'
const certDir = '.cert'
const keystoreFile = join(certDir, 'keystore.json')
const raw = {
iss: 'test',
@kamleshchandnani
kamleshchandnani / haproxy-reqrep.md
Last active April 25, 2023 15:50
Understanding "reqrep" in HA Proxy config

Let's assume we have following line in our HA proxy file:
reqrep ^([^\ :]*)\ /api/v1/api-name/(.*) \1\ /staging/path-name/\2
Here is our sample domain:
https://example.com/api/v1/api-name/

The goal here is to rewrite /api/v1/api-name/ to /staging/path-name/ leaving anything else unchanged.

Breaking the Regex and understanding in parts:
There are basically 3 parts in the regex: