Skip to content

Instantly share code, notes, and snippets.

@rodvan
rodvan / gist:503b6cd1cb4d74b1d70eea15a8b2f4b5
Created February 28, 2019 00:02
MQTT for Raspberry Pi
var mqtt = require('mqtt')
//var Gpio = require('onoff').Gpio; //include onoff to interact with the GPIO
var LEDA = new Gpio(3, 'out'); //use GPIO pin 4, and specify that it is output
var LEDB = new Gpio(4, 'out'); //use GPIO pin 4, and specify that it is output
const say = require('say')
function esperando() {
// stuff you want to happen right away
console.log('Prendiendo foco y esperando 2 segundos');
}
@rodvan
rodvan / smartconfig_save.ino
Last active January 24, 2019 19:20
SmartConfig ESP8266 save Wifi configuration on Pin0
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
void setup() {
int cnt = 0;
WiFi.mode(WIFI_STA);
Serial.begin(9600);
pinMode(0, INPUT_PULLUP);
Serial.println("2 sec before clear SmartConfig");
delay(2000);
@rodvan
rodvan / bash-cheatsheet.sh
Created November 19, 2018 03:45 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
import os, sys
a = 23
b = 23
lista = [23,32,43,54,63,72,84,93,102]
print(sys.version)
@rodvan
rodvan / .htaccess
Created April 3, 2017 17:53 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@rodvan
rodvan / gist:6084559f71b2ab78b6ede25ae47bcdd0
Created December 18, 2016 03:52 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@rodvan
rodvan / tor_curl.php
Created June 27, 2016 08:01 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@rodvan
rodvan / PHP-CURL-Tor-Tutorial.md
Created June 27, 2016 08:00 — forked from megaxorg/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor

#CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php5 php5-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

#!/usr/bin/perl
####### DON'T MODIF IT or SCRIPT NOT WORK #######
$powered="Shanti"; #
$mail="[email protected]"; #
#################################################
################################################
use HTTP::Request; #
use HTTP::Request::Common; #
use HTTP::Request::Common qw(POST); #
use LWP::Simple; #