Skip to content

Instantly share code, notes, and snippets.

View felipepodesta's full-sized avatar
👨‍💻
Stairway To Heaven

Felipe Podestá felipepodesta

👨‍💻
Stairway To Heaven
View GitHub Profile
@felipepodesta
felipepodesta / sample-script.sh
Created November 10, 2021 03:58 — forked from der3k/sample-script.sh
bash boilerplate
#!/bin/bash
# set -o errexit
# set -o pipefail
# set -o nounset
# set -o xtrace
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
@felipepodesta
felipepodesta / .functions
Created November 10, 2021 03:57 — forked from hiono/.functions
Shell Provisioner
#!/usr/bin/env bash
# load base functions
declare -F log_action_begin_msg > /dev/null
(( $? == 1 )) && source /lib/lsb/init-functions
# define checker
function _has_f () {
return 0;
}
@felipepodesta
felipepodesta / .bash_aliases
Created November 10, 2021 03:57 — forked from nafiesl/.bash_aliases
My .bash_aliases
# Shortcuts
alias hisgrep='history | grep'
alias syslog='sudo tail -f /var/log/kern.log'
alias aliasopen='vim ~/.bash_aliases'
alias editweb='vim routes/web.php'
alias aliassource='source ~/.bash_aliases'
alias hostsopen='sudo vim /etc/hosts'
alias neth='sudo nethogs ppp0'
alias dial='sudo wvdial --config=wvdial.conf'
alias dialg='sudo wvdial --config=gwvdial.conf'
#!/usr/bin/env bash
# use it while developing / testing.
# you may use it in production as well.
# set -o errexit -o pipefail -o noclobber -o nounset
# set -x
# compile Nginx from the official repo with brotli compression
[ ! -d /root/log ] && mkdir /root/log
Assuming you have followed all the steps to install / setup WSL2 -> https://docs.microsoft.com/en-us/windows/wsl/install-win10
**Tested on Ubuntu 20.04**
Step 1 - Find out default gateway and DNS servers
- Navigate to `Control Panel\Network and Internet\Network Connections`
- Right click on relevant connection type WiFi or Ethernet and select `Status`
- Status screen will be displayed, click on `Details` button
- Network Connection details screen will be displayed
- Note down `IPv4 default gateway` and `IPv4 DNS Servers` if available
@felipepodesta
felipepodesta / patch-net_http.rb
Created September 30, 2021 18:54 — forked from doubleotoo/patch-net_http.rb
Faraday: Disable SSL verification
# See project page: https://github.com/technoweenie/faraday
#
# This patch applies to:
#
# faraday (0.8.4)
# faraday_middleware (0.8.8)
require 'faraday'
module Faraday
class Adapter
@felipepodesta
felipepodesta / gist:41371fd6f1cbe8274dd33c84e4c6a0b6
Created September 30, 2021 18:53 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@felipepodesta
felipepodesta / cliref.md
Created June 7, 2021 15:55 — forked from yunga/cliref.md
CliRef, a copy/paste from whatisdb (somehow ordered)…
_________ _____ _______________       _____
\_   ___ \\    \\___________   \____ / ____\     ~/.bash/cliref.md
/    \  \/|    | |   ||       _/ __ \  __\    copy/paste from whatisdb
\     \___|__  |_|_  ||    |   \  __/|_ |   http://pastebin.com/yGmGiDQX
 \________  /_____ \_||____|_  /____  /_|     [email protected]
 20160515 \/ 1527 \/         \/     \/

alias CLIRef.txt='curl -s "http://pastebin.com/raw/yGmGiDQX" | less -i'

#!/usr/bin/env bash
# https://kkovacs.eu/cool-but-obscure-unix-tools
# https://stedolan.github.io/jq/
# https://github.com/jkbrzt/httpie
function install {
local package=$1
command -v apt > /dev/null 2>&1