Skip to content

Instantly share code, notes, and snippets.

View jesusprubio's full-sized avatar
🏴‍☠️

Jesús Rubio jesusprubio

🏴‍☠️
View GitHub Profile
@konsumer
konsumer / Gruntfile.js
Created January 10, 2014 00:11
Gruntfile for cordova: generates all images
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
app: {
name: '<%= pkg.name %>'
},
clean: {
@cef62
cef62 / gist:97323b13bf4a1fdbe650
Created November 7, 2015 20:12 — forked from whisher/gist:d6e3db7c11d632720133
Hapijs brute force mitigation
'use strict';
/**
* Module dependencies.
*/
const Hoek = require('hoek');
const Limiter = require('ratelimiter');
const RedisClient = require('../utils/redis');
const ReplyUtil = require('../utils/reply');
@mheadd
mheadd / registrar.js
Created April 6, 2011 18:26
A simple SIP registrar that uses Node.js and Redis
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@cbumgard
cbumgard / date-util.js
Created December 11, 2012 01:03
Formatting dates/times in node.js using Olson timezones and moment.js. Converts server-side timestamps to the browser's timezone.
var moment = require('moment');
var tz = require('timezone/loaded');
var time = require('time');
module.exports = function() {
var strftime_format = '%F %T %z'; // used to convert a date into a normalized strftime format with timezone
var moment_format = 'YYYY-MM-DD HH:mm:ss zz'; // moment.js LDML format for parsing date strings
/**
* Convert a Javascript Date into node-time wrapper with the appropriate timezone.
@apla
apla / icons_and_splash.js
Created August 7, 2013 23:15
cordova hook script to copy icons and splash screens to platform directories
#!/usr/bin/env node
var cordova_util = require('cordova/src/util');
var projectRoot = cordova_util.isCordova(process.cwd());
var projectXml = cordova_util.projectConfig(projectRoot);
var projectConfig = new cordova_util.config_parser(projectXml);
projectConfig.name();
var fs = require ('fs');
@boboldehampsink
boboldehampsink / ios_disable_push_notifications.js
Created March 17, 2015 15:11
Cordova - after_platform_add hook to disable push notifications code
#!/usr/bin/env node
var GCC_PREPROCESSOR_DEFINITIONS = '"$(inherited) DISABLE_PUSH_NOTIFICATIONS=1"';
var fs = require("fs");
var path = require("path");
var xcode = require('xcode');
var projectRoot = process.argv[2];
function getProjectName(protoPath) {
@nixpulvis
nixpulvis / proxy.rs
Last active November 29, 2018 13:09
// extern crate take5;
// extern crate remote;
use std::io::{Read, Write};
use std::net::{SocketAddr, TcpStream, TcpListener, Shutdown};
use std::thread;
use std::time::Duration;
use std::sync::{Arc, Mutex};
// use take5::player::AiPlayer;
// use remote::Client;
@max-mapper
max-mapper / readme.md
Last active June 3, 2020 00:31
automatically scan for and join open internet enabled wifi networks on linux using node.js (tested on raspberry pi raspbian)
@haugstrup
haugstrup / lcd.js
Created July 29, 2012 17:15
LCD proof of concept for johnny-five
// Wire up LCD as described here:
// http://learn.adafruit.com/character-lcds/overview
var five = require("johnny-five"),
board, lcd;
board = new five.Board();
board.on("ready", function() {
@chrismatthieu
chrismatthieu / gist:964754
Created May 10, 2011 15:58
SIP Registrar with Tropo PSTN
// Run Redis - cd redis-2.2.4 and run src/redis-server
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
var tropoapi = require('tropo-webapi');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');