Skip to content

Instantly share code, notes, and snippets.

View Raudcu's full-sized avatar

Lucas Pili Raudcu

View GitHub Profile
@Raudcu
Raudcu / mailto.py
Last active May 11, 2021 13:48
Python script to send mails with append
import argparse
import smtplib
from email.message import EmailMessage
import mimetypes
# Parser
parser = argparse.ArgumentParser(description="Send files through mail")
parser.add_argument("files", metavar="FILES", nargs="+", help="Files to send")
{
"command": {
"bind": {
"shift-pageup": "jupyter-notebook:move-cell-up",
"shift-pagedown": "jupyter-notebook:move-cell-down",
"n,n": "jupyter-notebook:restart-kernel-and-run-all-cells",
"u,u": "jupyter-notebook:restart-kernel-and-clear-output",
"g,g": "auto:hide_code:toggle_all",
"shift-u": "RISE:toggle-subslide"
}
@Raudcu
Raudcu / topdf
Created September 1, 2020 18:00
#!/bin/bash
# Script to convert multiple images to pdf and put them together into a single file.
# It executes in the directory where the images are: topdf IMG_1.jpg IMG_2.JPG IMG_3.jpeg OUTPUT_NAME
declare -a Files=("${@:1:$(( $#-1 ))}")
for file in ${Files[@]}
do
convert $file ${file%.*}.pdf
@Raudcu
Raudcu / cut_mp3.py
Created June 11, 2020 17:33 — forked from gchavez2/cut_mp3.py
Cut mp3 file with Python and pydub
# https://github.com/jiaaro/pydub
from pydub import AudioSegment
files_path = ''
file_name = ''
startMin = 9
startSec = 50
@Raudcu
Raudcu / awk.sh
Created February 15, 2020 22:05
Print columns with space between them and into a new file
awk -v OFS='\t' '{print $1, $2, $3, $4, "sweep_up", $5}' 170722_006.dat > a.dat
{
"codeCellConfig": {
"autoClosingBrackets": false
}
}
{
"shortcuts": [
{
"command": "jupyterlab_code_formatter:format",
"keys": [
"Ctrl Shift F"
],
"selector": ".jp-Notebook.jp-mod-editMode",
"args": {}
},
@Raudcu
Raudcu / plotly_min.py
Created February 6, 2020 18:40
Plotly minimum
import plotly.graph_objects as go
x = np.linspace(0,10,100)
fig = go.Figure()
fig.add_scatter(x=x, y=np.sin(x))
fig.show()
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import plotly.tools as tls
import numpy as np
fig, ax = plt.subplots()
x = np.linspace(0, 10)
ax.plot(x, np.sin(x), '--', linewidth=2)
ax.plot(x, np.cos(x), '--', linewidth=2)
@Raudcu
Raudcu / colormap.py
Created July 1, 2019 13:56
Plotting lines using a matplotlib colormap
import matplotlib.pyplot as plt
import matplotlib.cm as cmap
import matplotlib.colors as mcolors
rain = cmap.ScalarMappable(norm=mcolors.Normalize(vmin=0,vmax=1.), cmap='rainbow')
for i in range(10):
plt.plot(range(10), [x*i for x in range(10)], c=rain.to_rgba(i/10))
plt.show()