Skip to content

Instantly share code, notes, and snippets.

View levhita's full-sized avatar

Levhita Arias levhita

View GitHub Profile
@levhita
levhita / closing2_2.md
Last active May 22, 2018 18:09
Closing: haciendo tu sitio web interactivo

Closing: haciendo tu sitio web interactivo

DOM

  • ¿Qué es el DOM? Document Object Model

  • ¿Qué es un selector? Nos permite encontrar uno o más elementos HTML

  • ¿Cuál es la diferencia entre document.getElementById y document.getElementsByClassName? Además de que regresan elementos por distinto selector, el Elements regresa especificamente un arreglo, así devuelva un sólo elemento dentro.

@levhita
levhita / compare.php
Created May 10, 2018 21:23
Do you want to compare the repositories of 27+ students to catch if one of them is cheating?
<?php
$dirs = array_slice(scandir('.'), 2);
for($i=0;$i<count($dirs);$i++){
if ( is_dir($dirs[$i]) ){
$base = $dirs[$i];
for($j=0;$j<count($dirs);$j++){
if ($i!=$j) {
if ( is_dir($dirs[$j]) ){
$against = $dirs[$j];
@levhita
levhita / aoxygen8.ino
Last active August 2, 2017 05:44
Total replacement ofan old oxygen 8 v1 midi controller electronics using an Arduino Mega.
#include <MIDI.h>
#include <PCM.h>
#include <gemido.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
int oldStatusUp[25];
int newStatusUp[25];
int oldStatusDown[25];
@levhita
levhita / sociogram.html
Created January 17, 2017 22:23
tips and tricks for mongo
<!doctype html>
<html>
<head>
<title>Network | Basic usage</title>
<script type="text/javascript" src="http://visjs.org/dist/vis.js"></script>
<link href="http://visjs.org/dist/vis-network.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#mynetwork {
@levhita
levhita / subtitler.sh
Created January 28, 2016 22:38
Allows me to add subtitles to a sequence of images.
#!/bin/bash
input=$1
output=$2
declare -A st1=([text]="C IS THE FRUIT OF COMPUTING" [start]=80 [end]=123 )
declare -A st2=([text]="YOU CAN MAKE GAMES" [start]=124 [end]=161 )
declare -A st3=([text]="DATABASES, COMPILERS" [start]=162 [end]=210 )
declare -A st4=([text]="ENGINES, DRIVERS" [start]=211 [end]=247 )
declare -A st5=([text]="THERE'S, UM" [start]=248 [end]=265 )
@levhita
levhita / install-google-fonts-ubuntu.sh
Last active January 31, 2016 00:05
# Install Google webfonts on ubuntu
# Install Google webfonts on ubuntu
sudo apt-get -y install git
git clone https://github.com/google/fonts.git web_fonts_temp
mkdir -p ~/.fonts/google-fonts/
find $PWD/web_fonts_temp/ -name "*.ttf" -exec sudo install -m644 {} ~/.fonts/google-fonts/ \; || return 1
fc-cache -f > /dev/null
rm -rf web_fonts_temp
echo "Done."
@levhita
levhita / split.sh
Created November 6, 2015 20:02
Splits bulk files inside a folder into individual 001, 002. etcc folders with 800 files each. Use it so i can browse a lot of importes images without breaking ubuntu.
if [ ! -d "$1" ]; then
echo "Directory doesnt exists"
exit
fi
cd $1
fileCount=800
dirNum=1
@levhita
levhita / rename.sh
Last active November 6, 2015 20:08
Renames all jpgs in a folder sequentially, I use it to make surveillance bulk files compatible with OpenShot import functionality.
if [ ! -d "$1" ]; then
echo "Directory doesnt exists"
exit
fi
cd $1
a=1
for i in *.jpg; do
new=$(printf "%09d.jpg" "$a") #09 pad to length of 9
@levhita
levhita / movement.sh
Last active October 30, 2015 01:29
Takes all jpgs from the source folder and copies only the jpgs that present a significant difference, used to remove repeated frames from webcams output.
#/bin/bash
#We only allow empty destination folders.
if [ -d "$2" ]; then
echo "Directory already exists"
exit
fi
#If it doesn't exists create it.
if [ ! -d "$2" ]; then
mkdir $2
fi