Skip to content

Instantly share code, notes, and snippets.

View giobyte8's full-sized avatar

Giovanni Aguirre giobyte8

View GitHub Profile
@giobyte8
giobyte8 / sp
Created December 18, 2018 05:38 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@giobyte8
giobyte8 / queryParamReader.js
Created August 23, 2018 03:38
Read query param from javascript
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
@giobyte8
giobyte8 / ESP8266.sh
Created October 22, 2017 03:22
Basic AT commands for ESP8266
# Ping message
AT
# Change BAUD range
AT+CIOBAUD=9600
# Check SDK version
AT+GMR
@giobyte8
giobyte8 / primer.cpp
Last active May 28, 2017 22:43
A C++ program to determinate prime numbers
#include <iostream>
using namespace std;
int main() {
int n;
// Solicita al usuario el número de primos deseados
cout << "¿Cuántos números primos desea calcular? ";
cin >> n;
@giobyte8
giobyte8 / behaviorsYii2.php
Last active February 11, 2016 18:39
Autentication example
<?php
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
array( // Logged users (Admin & Capturista)
'actions' => [
'index',
@giobyte8
giobyte8 / gulpfile.js
Last active October 7, 2015 17:01 — forked from wesbos/gulpfile.js
FAST Browserify + Reactify + Babelify
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var babelify = require('babelify');
var watchify = require('watchify');
var notify = require('gulp-notify');
@giobyte8
giobyte8 / nsenter-compile-dockerized.sh
Last active September 10, 2015 02:15 — forked from mbn18/gist:0d6ff5cb217c36419661
How to install nsenter on Ubuntu 14.04
# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc.
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter
# start a container
docker run --name nsenter -it ubuntu:14.04 bash
## in the docker
apt-get update
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool
@giobyte8
giobyte8 / CreateTables.sql
Created August 31, 2015 05:51
Small script to create a sample database (Parking schema)
-- Create table ESTACIONAMIENTO
CREATE TABLE ESTACIONAMIENTO(
ID INT AUTO_INCREMENT PRIMARY_KEY,
NOMBRE VARCHAR(150),
COSTO_HORA INT NOT NULL,
COSTO_FRACCION INT NOT NULL
);
CREATE TABLE CAJON(
@giobyte8
giobyte8 / downloadServer.js
Created August 16, 2015 23:19
A simple nodejs file server (Server to download files)
/**
* Simple server to download files over network
*
* @author: Giovanni Aguirre | twitter: @DiganmeGiovanni
* @Created on: Aug 16, 2015
*/
// Importa y configura los modulos necesarios
@giobyte8
giobyte8 / server.js
Last active August 29, 2015 14:27
Parte 5 | Creando un sistema de chat sobre NodeJS con Foundation y Openshift
/**
* Server.js
* @author : DiganmeGiovanni | https://twitter.com/DiganmeGiovanni
* @Created on: 25 Oct, 2014
* Updated on: 15 Aug, 2015
*/
// ====================================================== //
// == MODULOS REQUERIDOS PARA LA APLICACIÓN