Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
Coding!

Rhuan rhuanbarreto

😃
Coding!
View GitHub Profile
@rhuanbarreto
rhuanbarreto / script.sh
Created Jun 10, 2020
Kill Defunct Processes in Linux
View script.sh
ps -ef | grep defunct | grep -v grep | cut -b8-20 | xargs sudo kill -9
@rhuanbarreto
rhuanbarreto / countries.json
Last active May 15, 2020 — forked from avlisodraude/countries.json
A list of countries in JSON
View countries.json
{
"rows": [
{ "name": "Afghanistan", "code": "AF" },
{ "name": "Åland Islands", "code": "AX" },
{ "name": "Albania", "code": "AL" },
{ "name": "Algeria", "code": "DZ" },
{ "name": "American Samoa", "code": "AS" },
{ "name": "AndorrA", "code": "AD" },
{ "name": "Angola", "code": "AO" },
{ "name": "Anguilla", "code": "AI" },
@rhuanbarreto
rhuanbarreto / script.sh
Created Apr 7, 2020
Install pg gem without database in Mac os
View script.sh
brew install libpq
bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
bundle install
@rhuanbarreto
rhuanbarreto / queryStringSerialize.js
Last active Feb 20, 2020
Serialize deep objects to URL Search Parameters query string
View queryStringSerialize.js
export const queryStringSerialize = (obj, prefix) => {
var str = [],
p;
for (p in obj) {
if (obj.hasOwnProperty(p)) {
var key = isNaN(parseInt(p, 10)) ? p : "";
var k = prefix ? prefix + "[" + key + "]" : p;
var v = obj[p];
str.push(
v !== null && typeof v === "object"
@rhuanbarreto
rhuanbarreto / store.js
Created Jan 9, 2019
Configure Redux DevTools with Redux Offline
View store.js
import { createStore, compose } from "redux";
import rootReducer from "./reducers";
import { offline } from '@redux-offline/redux-offline';
import config from '@redux-offline/redux-offline/lib/config';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export default createStore(
rootReducer,
composeEnhancers(
@rhuanbarreto
rhuanbarreto / command.sh
Created Nov 16, 2018
Delete all local untracked branches from git
View command.sh
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@rhuanbarreto
rhuanbarreto / nginx.conf
Created May 11, 2018
Jenkins configuration for Nginx reverse proxy
View nginx.conf
http {
# SSL Settings
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_tickets off;
ssl_certificate /certs/cert.crt;
ssl_certificate_key /certs/cert.key;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DHE+AES128:!ADH:!AECDH:!MD5;
@rhuanbarreto
rhuanbarreto / copy-docker.sh
Created Apr 12, 2018
Import Database from Backup File on SQL Server for Linux / Docker
View copy-docker.sh
# Copy backup file to Docker Container
# Remember to name your container with the --name parameter on docker start, so you can
# replace the SQL_Server name on the following command.
# Remember also to change the backup file path.
docker cp ~/database.bak SQL_Server:/var/opt/mssql/data/
@rhuanbarreto
rhuanbarreto / environment
Created Apr 10, 2018
Install and use Duplicity for Azure backup on Ubuntu Linux
View environment
# Add this lines to the /etc/environment file. Change account name key and passphrase according to your settings
AZURE_ACCOUNT_NAME=storageaccountname
AZURE_ACCOUNT_KEY=storageaccountkey
PASSPHRASE=passphrase_for_GPG_encryption
@rhuanbarreto
rhuanbarreto / install_homebrew.sh
Created Apr 1, 2018
Install Homebrew on MacOS X
View install_homebrew.sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You can’t perform that action at this time.