Skip to content

Instantly share code, notes, and snippets.

View jorgerance's full-sized avatar
💭
I may be slow to respond.

Jorge Rancé Cardet jorgerance

💭
I may be slow to respond.
View GitHub Profile
@jorgerance
jorgerance / figlet_install_fonts.sh
Created July 21, 2023 21:59 — forked from kenny-kvibe/figlet_install_fonts.sh
Install "figlet" & download figlet fonts
#!/bin/bash
########
#
# Install "figlet" package
# & Download figlet fonts
# (running as root)
#
# + Github Repositories:
#--> https://github.com/xero/figlet-fonts
#--> https://github.com/phracker/figlet-fonts
alias gg="git add main.py && git commit -m 'commit alias' && git push || \
printf \"\nRun 'git commit add -A' and push changes?\nPress ENTER to confirm: \n\"; \
read input; \
if [ -z ${input} ]; then \
printf '\nCommiting in 3...' && sleep 0.75 && \
printf '2...' && sleep 0.75 && \
printf '1...' && sleep 0.75 && \
printf \" ** Committing and pushing changes NOW! **\n\n\" && sleep 0.75 && \
git add -A && git commit -m 'commit alias' && git push || \
printf \"\n** ERROR: Not a git directory **\n\"; \
@jorgerance
jorgerance / fast.sh
Created July 1, 2021 20:32 — forked from nvk/fast.sh
OSX For Hackers
#!/usr/bin/env bash
##
# Install:
# curl -sL https://raw.github.com/gist/2108403/fast.sh | sh
#
# Share your feedbacks on:
# https://gist.github.com/2108403
#
# Author: @DAddYE (Twitter/Github)
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreiahcdraxdfaxpqinxucdy74jq5fh7hmk6pu2rupln2qzzag3sy53i ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@jorgerance
jorgerance / cat.sh
Created March 5, 2020 22:57
[cat with code highlighting]
cat() {
arguments="$*"
for i in $arguments; do
argument=$i
file_type=$(mdls "$argument"|grep '^kMDItemContentType '|awk -d'=' '{printf $3}'|tr -d '"')
printf "\n\n >>> File type: %s \n\n\n" "$file_type"
case "$file_type" in
"public.python-script"|"public.shell-script")
highlight -O ansi --force "$argument"
@jorgerance
jorgerance / transacional_store.md
Last active February 6, 2020 03:03
[PostgreSQL Trigger data copy to transactional on insert/update] #postgresql #function #trigger #update #insert #example #sql #history

Function definition, where:

  • fl_hist_portfolio is a transactional table.
  • coin, locked, free and updated are the fields to be updated on the transactional datastore.
  • NEW.coin, NEW.locked, NEW.free and NEW.updated refer to the new inserted data.
CREATE OR REPLACE FUNCTION fl_history_portfolio ()
RETURNS TRIGGER
AS
@jorgerance
jorgerance / print_imports_version.py
Created February 4, 2020 02:02
[print imports version] #python #imports #version
def imports_version():
"""
Print imported modules and its version
Source: https://stackoverflow.com/a/50396275
"""
import sys
for module in sys.modules:
try:
print(module,sys.modules[module].__version__)
@jorgerance
jorgerance / group_small_values.py
Last active February 4, 2020 01:05
[pandas - group small values] #python #pandas #data #datamanipulation #dataframe #jupyter #notebook
def group_small_values(data, idx, column, percentage):
"""
Groups small dataframe values into a sigle group
- data = source dataframe
- idx = column with qualitative values
- column = column to evaluate
- percentage = group values which value > sum(column)
"""
total_column = data[column].sum()
other_percentage = ((float(total_column) / float(100) * float(percentage)))
@jorgerance
jorgerance / pie_chart.py
Last active February 4, 2020 01:09
[pandas - cool pie (donut) charts] #pandas #jupyter #plotting #piechart #python
def plot_piechart(data, column_numbers, column_index):
"""
Plots a preformated pie chart
- data: dataframe
- column_values: column name for quantitative values
- column_index: column name for qualitative values
"""
''' colormaps: https://matplotlib.org/examples/color/colormaps_reference.html
https://matplotlib.org/tutorials/colors/colormaps.html#kovesi-colormaps'''
@jorgerance
jorgerance / bootstrap.sh
Last active February 14, 2024 00:43
[Raspberry Pi Bootstrap script] Setting up raspberry defaults with bash #bash #raspberry #boostrab #custom #image #customize
#!/bin/bash
# Fail on error
set -e
source "$1"
cd "$(dirname "$0")"
if [ $# -ne 1 ]; then