Skip to content

Instantly share code, notes, and snippets.

View vvo's full-sized avatar
:bowtie:
Breaking the web, one missing semicolon at a time

Vincent Voyer vvo

:bowtie:
Breaking the web, one missing semicolon at a time
View GitHub Profile
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@vvo
vvo / video-snapshots-sprites.sh
Created July 15, 2013 14:28
generate sprites of video snapshots
sudo aptitude install ffmpeg
sudo aptitude install imagemagick
# fps=1 > every seconds
ffmpeg -i video.mp4 -f image2 -vf fps=fps=1 out%d.png
# horizontal sprite, resized at 30%
convert -resize 30% +append out*.png sprite-1-sec.png
# references:
Slack emoji
@vvo
vvo / class.ts
Created September 2, 2021 09:32
import { Label, ModelType, Version } from "@customTypes/templates";
export default class Segmentation {
constructor(
public b64_mask = "",
public label = Label.Uncategorized,
public main_colors = "",
public model_type = ModelType.Free,
public model_version = Version.UnknownVersion,
public no_objects = false,
@vvo
vvo / stripe-customer-language-list.js
Created March 18, 2021 14:06
Stripe's customers language list
[
{ label: "Arabic", value: "ar-AR" },
{ label: "Danish", value: "da-DK" },
{ label: "German", value: "de-DE" },
{ label: "English", value: "en-US" },
{ label: "Spanish (Spain)", value: "es-ES" },
{ label: "Spanish (Latin America)", value: "es-419" },
{ label: "Finnish", value: "fi-FI" },
{ label: "French", value: "fr-FR" },
{ label: "Hebrew", value: "he-IL" },
@vvo
vvo / test.yml
Last active August 21, 2020 11:54
Rails and PostgreSQL setup for GitHub actions (CI)
name: Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
# Similar to docker-compose.yml but not the same, 🤷‍♂️
services:
2020-01-09T10:25:40.0633699Z ##[section]Starting: Request a runner to run this job
2020-01-09T10:25:40.2395888Z Requesting a hosted runner in current repository's account/organization with labels: 'ubuntu-latest', require runner match: True
2020-01-09T10:25:40.2946255Z Labels matched hosted runners has been found, waiting for one of them get assigned for this job.
2020-01-09T10:25:40.3373017Z ##[section]Finishing: Request a runner to run this job
2020-01-09T10:25:47.7137594Z Current runner version: '2.163.1'
2020-01-09T10:25:47.7138909Z Prepare workflow directory
2020-01-09T10:25:47.7363087Z Prepare all required actions
2020-01-09T10:25:47.7388745Z Download action repository 'actions/checkout@v2'
2020-01-09T10:25:49.6391641Z Download action repository 'eregon/use-ruby-action@master'
2020-01-09T10:25:49.8696320Z Download action repository 'actions/cache@v1'
@vvo
vvo / Algolia + React.markdown
Created July 21, 2016 07:37
Algolia + React
@vvo
vvo / .profile
Last active November 7, 2017 12:58
spr command line
#!/usr/bin/env bash
function spr() {
remoteOrigin=$(git remote get-url origin)
originGitHubUser=${remoteOrigin#git@github.com:*}
originGitHubUser=${originGitHubUser%%/*}
if [[ $1 == "--"* ]] # spr --branch
then
params=(${@:1})
var workers = [
{name: 'worker1', fn: function(task, cb) {/* some async processing */}},
{name: 'worker2', fn: function(task, cb) {/* some async processing */ }}
];
var tasks = ['one']; // this will be filled with a first task and then filled with more tasks from the workers
// I want to distribute tasks to workers, each worker can process only one task at a time
// workers will add more tasks while processing
// in some situations tasks may be empty and all workers processing