Skip to content

Instantly share code, notes, and snippets.

@micrometre
micrometre / client.html
Created October 7, 2023 09:25 — forked from matiasfha/client.html
nodejs + thrift +socket.io for image streaming
<script src="jquery-1.6.1.min.js"></script>
<script src="socket.io/socket.io.js"></script>
<script>
var socket = new io.Socket(null,{port:8080});
socket.connect();
socket.on('message',function(obj){
switch(obj.tipo){
case 'imagen':
img = document.getElementById('stream');
img.src="";
@micrometre
micrometre / mysql-docker.sh
Created December 18, 2021 00:03 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@micrometre
micrometre / terraform_digitalocean_dokku.tf
Created January 6, 2021 08:07 — forked from onnimonni/terraform_digitalocean_dokku.tf
Example terraform config for creating a digitalocean droplet with volume.
variable "digitalocean_token" {
description = "This is the Digitalocean API-token which is used to setup the machines."
}
variable "digitalocean_region" {
description = "For example: nyc1, nyc2, ams2, ams3, fra2"
default = "fra1"
}
variable "digitalocean_dokku_size" {
description = "Instance size: 512mb, 1gb, 2gb, 4gb ..."
default = "2gb"
@micrometre
micrometre / terraform_digitalocean_dokku.tf
Created January 6, 2021 08:07 — forked from onnimonni/terraform_digitalocean_dokku.tf
Example terraform config for creating a digitalocean droplet with volume.
variable "digitalocean_token" {
description = "This is the Digitalocean API-token which is used to setup the machines."
}
variable "digitalocean_region" {
description = "For example: nyc1, nyc2, ams2, ams3, fra2"
default = "fra1"
}
variable "digitalocean_dokku_size" {
description = "Instance size: 512mb, 1gb, 2gb, 4gb ..."
default = "2gb"
@micrometre
micrometre / linux-fake-webcam-loop.sh
Created April 7, 2020 16:26 — forked from zburgermeiszter/linux-fake-webcam-loop.sh
Loop video file as fake webcam device with ffmpeg
ffmpeg -re -f concat -i <(for i in {1..9999}; do printf "file '%s'\n" input.mp4; done) -f v4l2 /dev/video1 && !!
@micrometre
micrometre / index.html
Created March 13, 2020 13:38
JavaScript: Currency Calculator
3<div class="jumbotron">
<div class="container">
<h2>Currency Calculator</h2>
<p class="lead">Convert the currency</p>
<form class="form-inline">
<div class="form-group mb-2">
<input type="number" class="form-control" id="amount"/>
</div>
<div class="form-group mx-sm-3 mb-2">
<select class="form-control" id="currency-1" required>
@micrometre
micrometre / gist:3cc1276d328241c73fae4cd0f085cb36
Created January 10, 2020 14:33
Html css java-script counter
<!DOCTYPE html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CBW</title>
</head>
<style>
body {
background: lightblue;
@micrometre
micrometre / Email Server (Linux, Unix, Mac).md
Created December 7, 2019 00:54 — forked from raelgc/Email Server (Linux, Unix, Mac).md
Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@micrometre
micrometre / docker_wordpress.md
Created October 19, 2019 07:20 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@micrometre
micrometre / ffmpeg_frames.sh
Created October 4, 2019 11:18 — forked from loretoparisi/ffmpeg_frames.sh
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg