Skip to content

Instantly share code, notes, and snippets.

View arthurcgusmao's full-sized avatar

Arthur Colombini Gusmão arthurcgusmao

View GitHub Profile
@arthurcgusmao
arthurcgusmao / get_equal_parent.sh
Created November 4, 2021 09:54
Return the SHA of a parent commit that is equivalent to the current git commit. Useful for CI and DevOps purposes.
TARGET_COMMIT=${1:-HEAD}
if [ $TARGET_COMMIT == "-h" ]; then
echo "
Usage: ./get_equal_parent.sh <commit-hexsha>
Return the SHA of a parent commit that is equivalent (no diff) to the current
commit. If no equivalent parent commit exists, then return \"\".
"
exit
@arthurcgusmao
arthurcgusmao / seasonal_plot.py
Created May 15, 2019 16:32
Seasonal Plot in Python using Pandas and Seaborn
import pandas as pd
import seaborn as sns
def seasonal_plot(df, season='year', index='month', column=None):
"""Makes a seasonal plot of one column of the input dataframe. Considers the first columns by default.
Arguments:
- df (Pandas DataFrame): DataFrame indexed by Datetime (see `parse_dates` parameter when reading a CSV);
- season (string): the season that you want to considering when doing the plot, e.g., year, month, etc.;
@arthurcgusmao
arthurcgusmao / install-gnome-pomodoro-unity.sh
Last active May 30, 2018 13:22
Install gnome-pomodoro Ubuntu
# from http://www.webupd8.org/2017/02/gnome-pomodoro-pomodoro-timer-with.html
sudo apt remove gnome-shell-pomodoro gnome-shell-pomodoro-data
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/kamilprusko/xUbuntu_$(lsb_release -rs)/ /' > /etc/apt/sources.list.d/gnome-pomodoro.list"
wget http://download.opensuse.org/repositories/home:kamilprusko/xUbuntu_$(lsb_release -rs)/Release.key -O - | sudo apt-key add -
sudo apt update
sudo apt install gnome-pomodoro
@arthurcgusmao
arthurcgusmao / config_mouse_middle_scroll.md
Last active March 25, 2018 22:20
Configure middle button scroll for mouse when it's plugged in

Configure mouse's middle button scroll

This gist specifies how to setup the system to allow for mouse scrolling whenever the mouse (USB device) is plugged in.

Obs: it's not working. For some reason the script doesn't find xorg when trying to run when to mouse is plugged in, so the commands are not being applied. However, if they are called by a script after login and your mouse is already plugged in it will work.

References

@arthurcgusmao
arthurcgusmao / Convert `.dcm` to `.jpg`
Last active January 29, 2019 12:52
Convert .dcm files to .jpg shell script / command line
#!/bin/bash
EXTENSION=.dcm
FILES=*/*.dcm
mkdir outputs
for f in $FILES
do
echo "Converting $f file..."
fname="$(basename $f $EXTENSION)"
dcmj2pnm $f outputs/$fname.jpg +oj
done