This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deletes image files by size and extension | |
import os, glob, Image, sys | |
inipath = '/your/path/' | |
fileSize = (24,24) | |
fileExt = '.png' #.png .gif .jpg | |
def scandirs(path): | |
for currentFile in glob.glob( os.path.join(path, '*') ): | |
if os.path.isdir(currentFile): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
from bs4 import BeautifulSoup | |
my_url = 'http://slav0nic.org.ua/static/books/python/' | |
html=urllib2.urlopen(my_url).read() | |
sopa = BeautifulSoup(html) | |
current_link = '' | |
for link in sopa.find_all('a'): | |
current_link = link.get('href') | |
if current_link.endswith('pdf'): | |
print('Tengo un pdf: ' + current_link) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$6" ] | |
then | |
echo "Usage: `basename $0` [-n] <filename> <start time> <duration> <scale to width> <framestep> <resultname.gif>\n-n — turn off subtitles" | |
else | |
OPT= | |
if [ "$1" = "-n" ] | |
then | |
OPT="-nosub -noautosub" | |
shift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
cnn = sqlite3.connect('mydata.db') | |
mycursor = cnn.cursor() | |
# create table | |
sql_new_table = '''create table products | |
(code text, desc text, value real)''' | |
mycursor.execute(sql_new_table) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
Simple script to create geojson from osm files. | |
Prints geojson features line by line. | |
Currently we don't support relations. | |
Requires (unmodified) imposm and imposm.parser | |
Inspired by https://github.com/emka/OSMCouch | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Based on http://jswiki.lab-01.com/wiki/doku.php?id=install-couch | |
echo "Downloading Linux build tools and Erlang" | |
sudo apt-get install build-essential libicu-dev libcurl4-gnutls-dev libtool erlang-dev erlang zip -y | |
# Work on tmp directory | |
cd /tmp | |
# Spidermonkey is required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// External storage | |
String root = Environment.getExternalStorageDirectory().toString(); | |
// Internal storage | |
//String root = Environment.getRootDirectory().toString(); | |
File myDir = new File(root + "/mynewdir"); | |
myDir.mkdirs(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void writeFile(){ | |
String root = Environment.getExternalStorageDirectory().toString(); | |
//String root = Environment.getRootDirectory().toString(); | |
File myDir = new File(root + "/mydir"); | |
myDir.mkdirs(); | |
String fname = "myfile.txt"; | |
File file = new File (myDir, fname); | |
if (file.exists ()) file.delete (); | |
try { | |
BufferedWriter buf = new BufferedWriter(new FileWriter(file, true)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"log" | |
"flag" | |
"image" | |
_ "image/gif" | |
"image/jpeg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RestClient { | |
private ArrayList<NameValuePair> params; | |
private ArrayList<NameValuePair> headers; | |
private String url; | |
private int responseCode; | |
private String message; | |
OlderNewer