Skip to content

Instantly share code, notes, and snippets.

View camilonova's full-sized avatar

Camilo Nova camilonova

View GitHub Profile
@camilonova
camilonova / script.js
Created March 11, 2024 13:23
Calcular tasa de interes mensual a partir de tasa efectiva anual
function calculate(annualRate) {
// annual-rate could be integer 20 (as in 20%)
var periods = 12; // months in a year
var monthlyRate = ((Math.pow( (1 + (annualRate / 100) ), (30/360) ) - 1) * 100).toFixed(2)
return monthlyRate + "%";
}
@camilonova
camilonova / anonymize_database.sh
Created January 17, 2024 18:21
Get an anonimized database
# Run as: ./anonymize_database.sh my-database-production (database name)
set -e
# check if pganonymize is installed
if ! command -v pganonymize &> /dev/null
then
echo "pganonymize could not be found"
exit 1
fi
@camilonova
camilonova / gist:824c53d587f71af44f399e84e826465f
Created December 22, 2023 16:35
How I created a year in review of all the code we built
# clone the repo and make sure is updated, then create the log file:
gource --start-date "2023-01-01" --output-custom-log homeburgers-website.txt homeburgers-website/
# add a prefix so you can use different projects on the same video
sed -i -E -r "s#(.+)\|#\1|/homeburgers-website#" homeburgers-website.txt
# remove those extra files created on macOS (the `sed` command before shouldn't need `-E` but in this case was needed):
rm *.txt-E
# combine all the log files into a sorted combined file
@camilonova
camilonova / script.sh
Created April 1, 2020 20:07
Update every repository in the current directory
ls | xargs -P10 -I{} git -C {} pull
@camilonova
camilonova / create_webp_files.sh
Created October 30, 2019 22:29
This script creates web files in the current directory
#!/bin/bash
# converting JPEG images
find . -type f -and \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec bash -c '
for result; do
webp_path=$(sed '\''s/\.[^.]*$/.webp/'\'' <<< "$result");
if [ ! -f "$webp_path" ]; then
cwebp "$result" -o "$webp_path";
fi;
done
module.exports = {
config: {
updateChannel: 'stable',
fontSize: 13,
fontFamily: '"Source Code Pro", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
fontWeight: 'normal',
fontWeightBold: 'bold',
lineHeight: 1,
letterSpacing: 0,
cursorColor: '#d5d5d5',
syntax on
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
@camilonova
camilonova / .gitconfig
Last active April 1, 2020 20:05
GIT config
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit
push.default=matching
core.pager=diff-so-fancy | less --tabs=4 -RFX
color.diff-highlight.oldnormal=red bold
color.diff-highlight.oldhighlight=red bold 52
color.diff-highlight.newnormal=green bold
color.diff-highlight.newhighlight=green bold 22
color.diff.meta=yellow
color.diff.frag=magenta bold
color.diff.commit=yellow bold
@camilonova
camilonova / extensions.txt
Last active January 25, 2019 16:53
vscode settings
Django Template
EditorConfig
ESLint
Python
Sass
Sass Lint
Spacegray VSCode
@camilonova
camilonova / gist:d2a82989327b2353485aeb32aaf77f6c
Last active September 27, 2018 21:48
setup metric beat for kibana
sudo apt-get install metricbeat -y
# Add you domain
sudo vim /etc/metricbeat/metricbeat.yml
sudo systemctl enable metricbeat
sudo systemctl start metricbeat