Skip to content

Instantly share code, notes, and snippets.

View giflw's full-sized avatar
🚛

Guilherme I F L Weizenmann giflw

🚛
View GitHub Profile
@giflw
giflw / utils.liq
Last active August 19, 2019 07:40
Liquidsoap utils.liq modification to playlist.reloadable reloads more than once
# Turn a source into an infaillible source by adding blank when the source is
# not available.
# @param s the source to turn infaillible
# @category Source / Track Processing
def mksafe(~id="mksafe",s)
fallback(id=id,track_sensitive=false,[s,blank(id="safe_blank")])
end
# Alias for the <code>l[k]</code> notation.
# @category List
@giflw
giflw / postgres
Created April 6, 2016 19:08 — forked from mmrwoods/postgres
Postgres maintenance crontab file
# dump all databases once every 24 hours
45 4 * * * root nice -n 19 su - postgres -c "pg_dumpall --clean" | gzip -9 > /var/local/backup/postgres/postgres_all.sql.gz
# vacuum all databases every night (full vacuum on Sunday night, lazy vacuum every other night)
45 3 * * 0 root nice -n 19 su - postgres -c "vacuumdb --all --full --analyze"
45 3 * * 1-6 root nice -n 19 su - postgres -c "vacuumdb --all --analyze --quiet"
# re-index all databases once a week
0 3 * * 0 root nice -n 19 su - postgres -c 'psql -t -c "select datname from pg_database order by datname;" | xargs -n 1 -I"{}" -- psql -U postgres {} -c "reindex database {};"'
@giflw
giflw / estados-cidades.json
Last active July 26, 2017 23:46 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"states": [
{
"abbr": "AC",
"name": "Acre",
"capital": "Rio Branco",
"cities": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
@giflw
giflw / default.conf
Created January 30, 2018 17:22 — forked from cbmd/default.conf
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@giflw
giflw / jvectormap.brazil.js
Created December 21, 2018 14:41
Brazil map for JVector Map (http://jvectormap.com)
jQuery.fn.vectorMap('addMap', 'brazil', {"width":"1000","height":"921","paths":{"BRA1294":{"name":"Goiás","path":"M621.30 406.90l0.30 0.50 0.30 0.40 2.70 1.90 0.40 0.40 0.10 0.20 0.10 0.20 -0.10 0.20 0.00 0.10 -0.20 0.20 -0.20 0.20 -0.20 0.10 -1.30 0.90 -0.20 0.20 -0.10 0.30 -0.40 2.50 0.00 0.80 0.00 0.40 0.10 0.10 0.50 0.30 1.60 0.60 0.10 0.10 0.10 0.30 0.00 0.60 -0.10 0.30 -0.10 0.40 0.00 0.20 -0.10 0.10 -0.20 0.20 -0.70 0.60 -0.50 0.30 -0.80 0.40 -0.30 0.30 -0.30 1.10 -0.50 1.70 -0.40 1.20 -0.30 1.00 -0.10 0.30 0.00 0.20 -0.10 2.10 0.30 2.70 0.90 3.00 1.00 1.50 0.10 0.20 1.00 2.60 0.00 0.10 0.20 0.20 1.20 0.60 0.10 0.20 0.50 0.50 0.60 1.10 0.10 0.10 1.00 0.50 0.60 0.20 0.20 0.20 0.10 0.10 0.00 0.20 0.00 0.30 -0.30 1.10 -0.60 1.10 -0.10 0.20 0.00 0.30 0.00 0.60 0.00 0.50 0.20 0.50 0.00 0.10 0.30 0.40 0.40 0.90 0.10 0.60 0.10 0.40 0.10 0.70 -0.10 0.40 -0.10 0.40 -0.10 0.20 -0.10 0.30 -0.50 0.50 -0.50 0.50 -1.10 1.80 -0.60 0.30 -0.20 0.30 -0.20 0.30 -0.20 0.30 -0.20 0.20 -0.20 0.10 -0.10 -0.10 -0.40 -0.10 -0.
@giflw
giflw / nginx config for icecast2
Created May 20, 2019 00:52 — forked from highgain86j/nginx config for icecast2
nginx configuration for reverse-proxying icecast2 streaming server.
server {
listen 80;
listen [::]:80;
server_name radio.example.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
location / {
@giflw
giflw / clean_audio.sh
Created May 30, 2019 17:27 — forked from devoncrouse/clean_audio.sh
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@giflw
giflw / check.liq
Created September 2, 2019 23:27 — forked from gilou/check.liq
Playlist check function used with the logs in Liquidsoap
set("log.file.path", "/tmp/test.log")
set("server.socket.path","/tmp/<script>.sock")
set("server.socket",true)
# Simple check function to match any "Finished with ...." line in the logs
def checker(n)
# get info from upcoming request
m = request.metadata(n)
# command to find if the file was played according to the log
command = 'grep -F'
@giflw
giflw / hero.ts
Created September 25, 2019 03:08 — forked from brennanMKE/hero.ts
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@giflw
giflw / answerfile
Last active September 6, 2021 21:48 — forked from TechComSpot/answerfile
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"