Skip to content

Instantly share code, notes, and snippets.

View ajsb85's full-sized avatar
👨‍💻
Every day is a brand new day

Alexander Salas Bastidas ajsb85

👨‍💻
Every day is a brand new day
View GitHub Profile
@ajsb85
ajsb85 / 0_reuse_code.js
Created September 6, 2016 10:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ajsb85
ajsb85 / ssh-telegram.sh
Created May 29, 2016 14:19 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@ajsb85
ajsb85 / gist:acaacecad4da0deadae8
Created March 21, 2016 20:41 — forked from dustyf/gist:b6e72a7a7fd05de9598e
Example WordPress Simple JSON Endpoint Plugin
<?php
/**
* Plugin Name: WDS GIF API
* Plugin URI: http://webdevstudios.com
* Description: Adds a Custom Post Type to store GIFs and an API JSON Endpoint to access GIFs by a tag.
* Author: WebDevStudios
* Author URI: http://webdevstudios.com
* Version: 1.0.0
* License: GPLv2
*/
@ajsb85
ajsb85 / gist:beaf35ce35cfdd8c7db5
Created March 3, 2016 16:59
source code for remote controls Síragon & Soneview
*Source code for the transmission of commands and protocols remote controls Síragon & Soneview
*TV models:
*Model 1: Soneview SV-421, SV-425
*Model 2: Síragon HLT24. Soneview LED2401, SV-425
*Model 3: Síragon 3203T, 3205C, 4202T, 4204C. Soneview SV-321
#include <16F876A.h>
#fuses NOWDT,XT,NOPROTECT
@ajsb85
ajsb85 / angular-1.3.15-fxos.js
Last active August 29, 2015 14:26 — forked from coolaj86/angular-1.3.15-fxos.js
AngularJS v1.3.15 for Firefox OS #fxos
This file has been truncated, but you can view the full file.
/**
* @license AngularJS v1.3.15
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {'use strict';
/**
* @description
*
@ajsb85
ajsb85 / ibeacon.js
Last active August 29, 2015 14:21 — forked from janjongboom/ibeacon.js
navigator.mozBluetooth.defaultAdapter.startLeScan([]).then(handle => {
console.log('Start scanning', handle);
handle.ondevicefound = e=> {
var record = parseScanRecord(e.scanRecord);
if (record) {
console.log('Found an iBeacon', record.uuid, record.major, record.minor, e.rssi);
}
}
setTimeout(() => {
function stripAccents(str) {
var reAccents = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
var replacements = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
return str.replace(reAccents, function (match) {
return replacements[reAccents.source.indexOf(match)];
});
};
function stripAccents(str) {
var reAccents = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
var replacements = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
return str.replace(reAccents, function (match) {
return replacements[reAccents.source.indexOf(match)];
});
};
<?php
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w') // stderr
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: function() { console.log("standard progress callback"); },
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);