Skip to content

Instantly share code, notes, and snippets.

@persep
persep / dictionary.txt
Last active February 13, 2023 13:11
Examples of quoting in a bash asociative array or dictionary or hash
#!/bin/bash -e
declare -A dict
dict[f]="f"
dict["g"]="g"
echo "This works ${dict["f"]} ${dict["g"]}"
# This works f g
@persep
persep / workshop.txt
Created February 8, 2023 10:21
comman line workshop
export IMDB="https://www.imdb.com"
export TITLE="tt0944947"
curl -s "${IMDB}/title/${TITLE}/episodes?season=1" | less
seq 5 | parallel cowsay "{} sheep"
Executes not in order but in parallel:
cowsay "1 sheep"
...
cowsay "5 sheep"
@persep
persep / .tmux.conf
Created December 13, 2022 10:05 — forked from subfuzion/.tmux.conf
My .tmux.conf for tmux 2.1 (with fixes for mouse breakage)
# Inspirations:
# http://mutelight.org/practical-tmux
# http://zanshin.net/2013/09/05/my-tmux-configuration/
# http://files.floriancrouzat.net/dotfiles/.tmux.conf
# http://stackoverflow.com/questions/9628435/tmux-status-bar-configuration
# https://github.com/Lokaltog/powerline
# https://github.com/remiprev/teamocil
# http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux
# http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
#
@persep
persep / curl.md
Created December 13, 2022 09:50 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@persep
persep / loop-json.sh
Created October 26, 2022 13:44 — forked from IAmStoxe/loop-json.sh
This example shows you how to utilize jq to loop bash script through an array of JSON values.
jsonData='[{"name": "name#1","value": "value#1"},{"name": "name#2","value": "value#2"}]'
for row in $(echo "${jsonData}" | jq -r '.[] | @base64'); do
_jq() {
echo "${row}" | base64 --decode | jq -r "${1}"
}
# OPTIONAL
# Set each property of the row to a variable
name=$(_jq '.name')
value=$(_jq '.value')
@persep
persep / vacunas.R
Created March 29, 2021 13:08
Vacunas Coronavirus Autonomías
# Estado de vacunación de una autonomía
# Este conjunto de scripts sirve para ver el estado de vacunación de una autonomía. Por defecto sirve para Madrid pero cambiando dos variables puede servir para otra.
#
# autonomía: pondremos el nombre de la autonomía
# color_ccaa: pondremos la paleta para el color de las gráficas
#
# Hasta la fecha solo la he utilizado para Madrid (color rojo) y para Andalucía (color verde)
library(tidyverse)
# Install and load required packages
install.packages("needs")
library(needs)
needs(tidyverse, magrittr, animation, pdftools, png, scales)
# Function that extracts data from Google Mobility PDFs
process_google_mobility <- function(country_code, start_date, end_date){
# Convert first page of PDF into high-res PNG
pdf_convert(paste0("https://www.gstatic.com/covid19/mobility/",end_date,"_",country_code,"_Mobility_Report_en.pdf"), format = "png", pages = 1, dpi = 300, filenames = "IMG1.png")
HTML
- Semantic HTML
- Event delegation
- Accessibility / ARIA
CSS
- Specificity
- Pseudo-elements
- Pseudo-selectors
- Combinators
@persep
persep / profiles.json
Created April 1, 2020 15:37
VS Code settings
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{772206c0-bb2b-42ee-86e5-aa9e0309d799}",
"profiles":
@persep
persep / onlinemapsources.xml
Created February 4, 2019 08:50 — forked from emilydohrem1111/onlinemapsources.xml
Google Maps for OruxMaps, copy to PATH_TO_SDCARD/oruxmaps/mapfiles/
<onlinemapsource uid="0">
<name>Google Maps</name>
<url><![CDATA[https://www.google.com/maps/vt/lyrs=m&x={$x}&y={$y}&z={$z}&scale=2]]></url>
<minzoom>0</minzoom>
<maxzoom>19</maxzoom>
<projection>MERCATORESFERICAx512</projection>
<servers>0,1,2,3</servers>
<httpparam name=""></httpparam>
<cacheable>1</cacheable>
<downloadable>1</downloadable>