Skip to content

Instantly share code, notes, and snippets.

View thblckjkr's full-sized avatar
🎯
Focusing

Teo Gonzalez thblckjkr

🎯
Focusing
View GitHub Profile
@thblckjkr
thblckjkr / gist:15497cd6f000652163511b3b03850d47
Last active January 19, 2018 23:29
Prevent proxy on apt-get
Prevent proxy on APT-get
sudo apt-get -o Acquire::http::proxy=false
Prevent Proxy on NPM
npm config rm proxy
npm config rm https-proxy
npm update --noproxy
/*
* Reloader for any page
*
* Dependences:
* JQuery (?)
*
* Author: [thblckjkr]
*/
var Reloader = function (options) {
this.timeToReload = 45; // Time to reload the page (in seconds)
@thblckjkr
thblckjkr / index.js
Created January 24, 2018 05:13
Simply get on NodeJS
var options = {
host: this.blackbox.ip,
port: this.blackbox.port,
path: '/alive',
method: 'GET',
headers: {
'Accept': 'application/json',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=0.8'
}
@thblckjkr
thblckjkr / tmux-cheatsheet.markdown
Created February 13, 2018 05:56 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@thblckjkr
thblckjkr / simple_backup.sh
Created September 10, 2018 06:00
A really simple backup of webserver, including mysql, mongodb and code
#! /bin/bash
# You need to execute this bash file on tmux, to have an easy way to see the output
# then, just execute the script and have a daily report of the status
#
# Default ouput on $path/log.md can be readed by markdown and by a human
#
# Maybe you'll need to do some modifications
# Autor: Teo Gonzalez Calzada @thblckjkr
# Global variables
@thblckjkr
thblckjkr / directoryparse.js
Last active February 24, 2019 21:51
Creates an object from a html string obtained from an index of apache directory. Translates an APACHE default directory listing, to javascript object.
/**
* Requires JQuery >= 1.8
* @param {info} str string-based data of the
* Author: @thblckjkr | Theo G
* Ported to JQuery from https://github.com/juliangruber/parse-apache-directory-index
* Usage:
* $.get("/a/directory/path", function(data, status){
* var files = directoryparse(data);
* console.log(files);
* })
@thblckjkr
thblckjkr / affine.js
Created February 1, 2019 01:55
JavaScript algorithm to cipher/decipher text with the affine method
/**
* Affine Cipher Class.
*
* Class to cipher text using the affine method.
*
* @version 0.0.1
* @file This files defines the AffineCipher class.
* @author Teo Gonzalez Calzada [thblckjkr].
*/
@thblckjkr
thblckjkr / verify.php
Created February 24, 2019 21:50
Verify google reCAPTCHA with PHP. Clean and universal function.
<?php
/*
Decided to put this function as a gist itself, taken from this great comment
https://gist.github.com/jonathanstark/dfb30bdfb522318fc819#gistcomment-2733991
*/
function validate_rechapcha($response){
// Verifying the user's response (https://developers.google.com/recaptcha/docs/verify)
$verifyURL = 'https://www.google.com/recaptcha/api/siteverify';
// Collect and build POST data
#! /bin/bash
# You need to execute this bash file on tmux, to have an easy way to see the output
# then, just execute the script and have a daily report of the status
#
# Default ouput on $path/log.md can be readed by markdown and by a human
#
# Maybe you'll need to do some modifications
# Autor: Teo Gonzalez Calzada @thblckjkr
# Global variables
@thblckjkr
thblckjkr / numbers.py
Created May 19, 2019 22:30
Just a simple python script for a homework
import math
times = [1000, 60000, 3600000, 86400000, 2592000000, 31104000000, 3110400000000]
for n in times:
print("\nCunando n= \t", n)
print ("lg(n)= \t\t", math.log(n, 2))
print ("sqr(n)= \t", math.sqrt(n))
print ("n lg(n)= \t", ( n *math.log(n, 2) ) )
print ("n ^2 = \t", n**2 )
print ("n ^3 = \t", n**3 )