Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jorge Arévalo jorgeas80

🎯
Focusing
View GitHub Profile
@jorgeas80
jorgeas80 / unzip_to_dir.py
Created Apr 15, 2021
Unzips all files in a dir, extracting the files one by one, with a rusty status report
View unzip_to_dir.py
import os, zipfile
import sys
dir_name = sys.argv[1] if len(sys.argv) > 1 else None
extension = sys.argv[2] if len(sys.argv) > 2 else ".zip"
if not dir_name:
print("No dir name")
sys.exit(1)
View resume.json
{
"basics": {
"name": "Jorge Arevalo",
"label": "Python/Django Web Developer",
"summary": "I’m a software developer since 2007. Specialized in web development with Python and Django. Previous experience with C as developer of GDAL PostGIS Raster driver and PostGIS Raster extension. Also experience as tech trainer.",
"website": "https://about.me/jorgeas80",
"email": "jorgeas80@tuta.io",
"location": {
"city": "Madrid",
"countryCode": "ES"
@jorgeas80
jorgeas80 / ren.sh
Created Mar 20, 2020
Batch rename files in a dir to a sequential name by file date
View ren.sh
#!/bin/bash
a=1
for i in *.png; do
new=$(printf "%04d.png" "$a") #04 pad to length of 4
mv -i -- "$i" "$new"
let a=a+1
done
@jorgeas80
jorgeas80 / pdb_tricks
Last active Jan 27, 2020
A few useful tricks when debugging code with [i]pdb
View pdb_tricks
# Put a breakpoint in a file that is not part of our code
# Ref: https://stackoverflow.com/q/13589736/593722
(Pdb) import sys
(Pdb) sys.path.append("/home/user/path/to/another/module")
(Pdb) import another_module
(Pdb) b another_module:356
Breakpoint 1 at /home/user/path/to/another/module/another_module.py:356
(Pdb) c
# Conditionally hit the breakpoint #1
View regexp.sh
# Delete starting and ending blank spaces
s/^\s+|\s+$|\s+(?=\s)
# Delete duplicated lines, after sorting
^(.+)$\n^\1$
@jorgeas80
jorgeas80 / docker_cheatsheet
Last active Jan 27, 2020
Get running docker containers
View docker_cheatsheet
# Get docker container names
docker ps --format "{{.Names}}"
# Stop all running containers
docker stop $(docker ps -aq)
@jorgeas80
jorgeas80 / install_docker_ubuntu_1910.sh
Created Nov 16, 2019
Script to install docker in ubuntu 19.10
View install_docker_ubuntu_1910.sh
#!/bin/sh
CONTAINERD_VERSION="1.2.10-3"
DOCKER_CE_CLI_VERSION="19.03.3~3-0"
DOCKER_CE_VERSION="19.03.3~3-0"
echo "# DOWNLOAD THE DOCKER FILES"
wget "https://download.docker.com/linux/ubuntu/dists/disco/pool/stable/amd64/containerd.io_"$CONTAINERD_VERSION"_amd64.deb"
wget "https://download.docker.com/linux/ubuntu/dists/disco/pool/stable/amd64/docker-ce-cli_"$DOCKER_CE_CLI_VERSION"~ubuntu-disco_amd64.deb"
wget "https://download.docker.com/linux/ubuntu/dists/disco/pool/stable/amd64/docker-ce_"$DOCKER_CE_VERSION"~ubuntu-disco_amd64.deb"
@jorgeas80
jorgeas80 / zshrc
Created Nov 5, 2019
My ~/.zshrc config file
View zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/jorgearevalo/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@jorgeas80
jorgeas80 / vimrc
Created Nov 5, 2019
My ~/.vimrc config file
View vimrc
set nocompatible
filetype off
filetype indent plugin on
" Buffers
nnoremap gp :bp<CR>
nnoremap gn :bn<CR>
nnoremap gl :ls<CR>
nnoremap gb :ls<CR>:b
@jorgeas80
jorgeas80 / wallabag_delete_duplicates.py
Created Feb 18, 2019
Script to delete duplicate entries in your wallabag account
View wallabag_delete_duplicates.py
#!/usr/bin/env python
# Requires Python > 3.5.2
import aiohttp
import asyncio
from wallabag_api.wallabag import Wallabag
# If you use wallabag.it this is: https://app.wallabag.it
my_host = 'MY_HOST'