Skip to content

Instantly share code, notes, and snippets.

View crojasaragonez's full-sized avatar

Carlos Luis Rojas Aragonés crojasaragonez

View GitHub Profile
sudo firewall-cmd --add-port=8008-9000/tcp --permanent
sudo firewall-cmd --add-port=1900/udp --permanent
sudo firewall-cmd --add-port=5353/udp --permanent
sudo firewall-cmd --reload
@crojasaragonez
crojasaragonez / cors_with_headers.js
Created June 12, 2020 00:42
Cors with custom headers
//server code
const express = require('express')
const cors = require('cors')
const app = express()
const port = 3000
//whitelist of custom headers
app.use(cors({origin: '*', exposedHeaders: 'X-LH-Auth,X-Powered-By' }))
@crojasaragonez
crojasaragonez / Foreign table postgres
Created May 8, 2020 16:07
describes how to configure a foreign table in postgres
create extension postgres_fdw;
CREATE SERVER postgres_2
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (dbname 'db_2', host '172.17.0.4', port '5432');
CREATE USER MAPPING FOR CURRENT_USER
SERVER postgres_2
OPTIONS (user 'usr', password 'pwd');
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@crojasaragonez
crojasaragonez / capybara cheat sheet
Created March 23, 2016 17:12 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@crojasaragonez
crojasaragonez / watch.sh
Created January 5, 2016 22:25 — forked from mikesmullin/watch.sh
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
require 'date'
SECONDS_PER_CHUNK = 300
FILE_NAME = 'file.mp3'
seconds = %x(mp3info -p "%S\n" #{FILE_NAME}).to_i
today = Date.today
start_date = Time.new(today.year, today.month, today.day)
end_date = start_date + seconds