Skip to content

Instantly share code, notes, and snippets.

View davidglezz's full-sized avatar
😃
Happy

David Gonzalez davidglezz

😃
Happy
View GitHub Profile
@davidglezz
davidglezz / post-receive
Created October 12, 2016 22:16 — forked from sergeylukin/post-receive
Git hook (post-receive): update working tree on PUSH
#!/bin/sh
#
# This hook is placed in Bare repository and it updates Working tree whenever a PUSH
# is executed
#
# Assuming following file structure:
# .
# |-- myproject
# |-- myproject.git
# set WORKTREE=../myproject
@davidglezz
davidglezz / dabblet.css
Last active September 24, 2017 12:03 — forked from LeaVerou/dabblet.css
Slanted tabs with CSS 3D transforms
/**
* Slanted tabs with CSS 3D transforms
* See http://lea.verou.me/2013/10/slanted-tabs-with-css-3d-transforms/
*/
body { padding: 50px; }
nav {
position: relative;
z-index: 1;
@davidglezz
davidglezz / FastFtol.cpp
Created June 12, 2014 19:14
Fast Float to Int conversion
inline int FastFtol(const float a)
{
static int b;
#if defined(_MSVC)
__asm fld a
__asm fistp b
#elif defined(__GNUG__)
// use AT&T inline assembly style, document that
@davidglezz
davidglezz / generateFiles.sh
Created February 11, 2014 09:04
Little script to generate 1000 folders, with 100 files each of 100kbyte.
for i in `seq 1 1000`; do
mkdir -p files-$i;
for j in `seq 1 100`; do
dd if=/dev/zero of=files-$i/$j bs=100k count=1 2> /dev/null;
done;
done
@davidglezz
davidglezz / TuentiPhotoRemove.js
Last active August 29, 2015 13:56
Tuenti Photo Delete Script :: Script que automatiza el proceso de eliminación de fotos. ¿Como se usa? Abre el album de fotos que subiste, pulsa F12 dirígete a la pestaña consola, pega el script y pulsa "Enter".
var urlFotoAnterior = "";
var interval = setInterval(function (){
try {
var urlFotoActual = document.getElementById("photo_image").getAttribute("src");
if (urlFotoActual != urlFotoAnterior)
{
urlFotoAnterior = urlFotoActual;
document.getElementById("photo-actions-remove").click();
@davidglezz
davidglezz / TuentiPhotoUntag.js
Last active August 29, 2015 13:56
Tuenti Photo Untag Script :: Script que automatiza el proceso de desetiquetarse de fotos. ¿Como se usa? Abre el album de fotos en las que estas etiquetado, pulsa F12 dirígete a la pestaña consola, pega el script y pulsa "Enter".
var urlFotoAnterior = "";
var interval = setInterval(function() {
try {
var urlFotoActual = document.getElementById("photo_image").getAttribute("src");
if (urlFotoActual != urlFotoAnterior)
{
urlFotoAnterior = urlFotoActual;
document.querySelector("#edit_tag_list .js-deleteTag .avatar").click();
@davidglezz
davidglezz / getMonthDays.js
Last active August 29, 2015 13:56
Gets the number of days in a month (0-11)
// without lookup table
function getMonthDays_A (month, year)
{
if (month === 1)
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28;
if (month % 2)
return month > 6 ? 31 : 30;
return month > 6 ? 30 : 31;
@davidglezz
davidglezz / TuentiCommentAutoDelete.js
Last active January 4, 2016 05:49
Tuenti Comment Auto Delete Script :: Script que automatiza el proceso de eliminación de comentarios del tablon. ¿Como se usa? Sitúate en la pagina de tu perfil, Pulsa F12 dirígete a la pestaña consola, pega el script y pulsa "Enter". Ahora no toque nada, los comentarios se irán borrando automáticamente. Probado con Google Chrome 33 y Tuenti 2014…
var intervalo = null;
function DeleteCommentInterval()
{
try {
var coment = document.querySelector("#wallpost-list .itm-actions-trans button.action")
if (coment == null)
{
@davidglezz
davidglezz / TuentiPhotoDownloader.js
Last active January 4, 2016 04:18
Tuenti Photo Downloader Script :: Script que automatiza el navegador y guarda las fotos de la red Social Tuenti con nombre de la fecha en que fueron subidas. ¿Como se usa? Abre un album de fotos, Pulsa F12 dirígete a la pestaña consola, pega el script y pulsa "Enter". Ahora no toque nada, las fotos irán pasando solas y descargándose. Probablemen…
var elementoFoto = null, urlFotoActual = "", urlFotoAnterior = "", intervalo = null, fechaAnt = '', dCont = 0;
function intervalDescargarFoto()
{
try {
elementoFoto = document.getElementById("photo_image");
urlFotoActual = elementoFoto.getAttribute("src");
if (urlFotoActual != urlFotoAnterior)
return;
@davidglezz
davidglezz / utf16_to_utf8.c
Created January 13, 2014 23:11
utf16_to_utf8 function, untested by me, but I hope it works well, comes from opusfile with some modifications.
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
static char* utf16_to_utf8 (const wchar_t *src)
{
size_t len = wcslen(src), si, di;
char *dst = (char*)malloc(sizeof(*dst)*(3*len+1));