Skip to content

Instantly share code, notes, and snippets.

public class InteractiveView : UIView
{
public bool IsDragDisabled {
get;
set;
}
public bool IsPinchDisabled {
get;
set;
@lineker
lineker / extract_url.py
Created April 15, 2015 01:43
Scrapping web with python and lxml
from lxml import html,etree
import requests
import pprint
#This will create a list of buyers:
#buyers = tree.xpath('//div[@title="buyer-name"]/text()')
#This will create a list of prices
#prices = tree.xpath('//span[@class="item-price"]/text()')
#print 'Buyers: ', buyers
#print 'Prices: ', prices
@lineker
lineker / untitled
Created April 5, 2015 18:44
Test gist
Test gist
@lineker
lineker / gist:74c47c325ee1f9e822dd
Created September 28, 2014 08:56
example json
{"id":"b9407f30-f5f8-466e-aff9-25556b57fe6d","name":"Mona Lisa","images":[{"url":"image1","time":0, "text":"hello monalisa"},{"url":"image2","time":50000, "text":"hello leonardo"}, {"url":"image3","time":80000, "text":"hello monalisa"}, {"url":"image4","time":120000, "text":"hello monalisa"}],"audioUrl":"https://wearhacksmusic.blob.core.windows.net/asset-27608814-c12a-40d8-ab04-d5a631936e87/ACDC%20-%20You%20Shook%20Me%20All%20Night%20Long.mp4?sv=2012-02-12&sr=c&si=0462accd-c2f2-48ce-802a-f43c67f131f8&sig=HUqZaCAPgLm7uzovyi4FjJxG3s2TGoj1k7x1b2j3vdE%3D&st=2014-09-28T04%3A02%3A18Z&se=2016-09-27T04%3A02%3A18Z"}

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@lineker
lineker / WPAreaver
Created April 14, 2013 03:13
WPA reaver
wash -i mon0
airmon-ng start wlan0
wash -i mon0
reaver -i mon0 -b 00:14:D1:B6:83:AB -vv
@lineker
lineker / gist:2004309
Created March 9, 2012 00:22
PHP: Check if URL is available
//check if url is available
function is_available($url, $timeout = 30) {
$ch = curl_init(); // get cURL handle
// set cURL options
$opts = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser
CURLOPT_URL => $url, // set URL
CURLOPT_NOBODY => true, // do a HEAD request only
CURLOPT_TIMEOUT => $timeout); // set timeout
curl_setopt_array($ch, $opts);
@lineker
lineker / gist:2004304
Created March 9, 2012 00:21
PHP: Download remote file CURL
function download_remote_file($file_url, $save_to)
{
//myecho($file_url."---->".$save_to);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch,CURLOPT_URL,$file_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$file_content = curl_exec($ch);
curl_close($ch);
@lineker
lineker / gist:2004301
Created March 9, 2012 00:20
PHP: Download XML using GET and CURL
$url = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);
return $xml;