Skip to content

Instantly share code, notes, and snippets.

@urielaero
urielaero / spotify_to_text.js
Created March 22, 2022 04:58
Spotify Playlist To Text 21-mar-2022
// CTRL + SHIFT + C and run:
const songs = [...document.querySelectorAll("[role='row']")].map((e) => {
const childs = e.firstChild.childNodes[1];
if (!childs) { return ''; }
const song = e.firstChild.childNodes[1].childNodes[1];
return song.firstChild.textContent + " - " + song.childNodes[1].textContent;
}).join("\r\n")
console.log(songs);
@urielaero
urielaero / split_csv.sh
Created January 19, 2022 18:09
Split CSV with bash
#!/bin/bash
# usage $1: number_files $2: filename $3: [output_path]
# example:
# $ ./split_csv.sh 2 my_dir/large_file.csv ./output_dir
if [ $# -ge 3 ]
then
mkdir -p $3
fi
@urielaero
urielaero / configure-container-run.sh
Created March 20, 2019 14:59
configure ubuntu (docker container) with oh-my-zsh.
#!/bin/bash
apt update
apt install vim curl git zsh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@urielaero
urielaero / backup_and_upload_s3.sh
Last active March 4, 2019 22:51
mysqldump and upload to s3
#!/bin/bash
# mysql -u root -p
PASSWORD="PASSWORD"
USER="USER"
bucket="BUCKETNAME"
s3Key="S3KEY"
s3Secret="S3SECRETKEY"
echo "----- $(date) -----"
echo "run backup"
<files *.js.gz>
AddType "text/javascript" .gz
AddEncoding gzip .gz
</files>
<files *.css.gz>
AddType "text/css" .gz
AddEncoding gzip .gz
</files>
@urielaero
urielaero / CronJob.js
Last active September 16, 2017 06:34
services/CronJob.js
var doneList = []; //0 results in search
module.exports = {
run: function(minutes) {
Entity.find()
.sort('createdAt DESC')
.populate('webSearches')
.then((entities) => {
console.log('working');
const next = entities.find((ent) => {
return !ent.webSearches.length && doneList.indexOf(ent.id) === -1;
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.8.6
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
#
map <F5> :set expandtab tabstop=4<cr>
map <F6> :set foldmethod=syntax <cr>
map <F7> :set cursorcolumn cursorline <cr>
map <F8> :tabs <cr>
map <F9> :tabn <cr>
map <F8> :setlocal spell spelllang=es_es<cr>
set background=dark
set number
set autoindent
syntax on
@urielaero
urielaero / caballos.c
Last active December 12, 2015 02:08
Sencilla solución de el problema de mover al caballo de ajedrez por las 64 casillas sin repetirlas usando recursividad (backtracking), con arrays dinámicos. (Este código solo imprime una solución)
#include <stdio.h>
#include <stdlib.h>
/*
Sencilla solución de el problema de mover al caballo de ajedrez por las
64 casillas sin repetirlas usando recursividad (backtracking),
con arrays dinámicos. (Este código solo imprime una solución)
*/
void caballo(int i,int j,int **vec,int **puesto);
void limpiar(int **m,unsigned nFil,unsigned nCol);
void imp(int **vec,unsigned nFil,unsigned nCol);
@urielaero
urielaero / reinas.c
Last active March 12, 2021 22:27
Sencilla solución de el problema de las 8 reinas usando recursividad (backtracking), con arrays dinámicos. (Este código solo imprime una solución)
#include <stdio.h>
#include <stdlib.h>
/*
Sencilla solución de el problema de las 8 reinas usando recursividad
(backtracking), con arrays dinámicos. (Este código solo imprime una solución)
*/
int *crearVec(int t);
void llenarPositivo(int *v,int t);
void reinas(int i,int *vec,int *puesto,int *diag2_1,int *diag1_2);
void imp(int *vec);