Skip to content

Instantly share code, notes, and snippets.

Avatar

Giovanni Aguirre giobyte8

View GitHub Profile
@giobyte8
giobyte8 / sp
Created Dec 18, 2018 — 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.
View sp
#!/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 Aug 23, 2018
Read query param from javascript
View queryParamReader.js
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 Oct 22, 2017
Basic AT commands for ESP8266
View ESP8266.sh
# Ping message
AT
# Change BAUD range
AT+CIOBAUD=9600
# Check SDK version
AT+GMR
@giobyte8
giobyte8 / primer.cpp
Last active May 28, 2017
A C++ program to determinate prime numbers
View primer.cpp
#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 Feb 11, 2016
Autentication example
View behaviorsYii2.php
<?php
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
array( // Logged users (Admin & Capturista)
'actions' => [
'index',
@giobyte8
giobyte8 / gulpfile.js
Last active Oct 7, 2015 — forked from wesbos/gulpfile.js
FAST Browserify + Reactify + Babelify
View gulpfile.js
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 Sep 10, 2015 — forked from mbn18/gist:0d6ff5cb217c36419661
How to install nsenter on Ubuntu 14.04
View nsenter-compile-dockerized.sh
# 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 Aug 31, 2015
Small script to create a sample database (Parking schema)
View CreateTables.sql
-- 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 Aug 16, 2015
A simple nodejs file server (Server to download files)
View downloadServer.js
/**
* 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 Aug 29, 2015
Parte 5 | Creando un sistema de chat sobre NodeJS con Foundation y Openshift
View server.js
/**
* Server.js
* @author : DiganmeGiovanni | https://twitter.com/DiganmeGiovanni
* @Created on: 25 Oct, 2014
* Updated on: 15 Aug, 2015
*/
// ====================================================== //
// == MODULOS REQUERIDOS PARA LA APLICACIÓN