Skip to content

Instantly share code, notes, and snippets.

View ourway's full-sized avatar
🏆

Farshid Ashouri ourway

🏆
View GitHub Profile
@qingfeng
qingfeng / seximage.py
Created October 28, 2008 09:38
Image is a porn image?
#!/usr/local/bin/python
import sys, Image
if __name__ == '__main__':
fn = sys.argv[1]
img = Image.open(fn).convert('YCbCr')
w, h = img.size
data = img.getdata()
cnt = 0

Whenever there is some portion of an application that is the product of a difficult or uncertain design decision, or that takes a dependency on an external system that has a fair chance of changing, isolating that part of the application behind a generic interface reduces the chaos in your app when things do eventually need to change.

See also: See also: http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf

@jhnklly
jhnklly / heritage.json
Last active April 12, 2016 19:01
Random map/image, world heritage sites
[
{
"unique_number":230,
"id_no":208,
"name_en":"Cultural Landscape and Archaeological Remains of the Bamiyan Valley",
"longitude":67.8253,
"latitude":34.8469,
"area_hectares":158.9265
},
{
@dmitric
dmitric / backend.py
Created March 24, 2012 18:06
SqlAlchemy usage with tornado backend
class Backend(object):
def __init__(self):
engine = create_engine("mysql://{0}:{1}@{2}/{3}".format(options.mysql_user, options.mysql_pass, options.mysql_host, options.mysql_db)
, pool_size = options.mysql_poolsize
, pool_recycle = 3600
, echo=options.debug
, echo_pool=options.debug)
self._session = sessionmaker(bind=engine)
@classmethod
@z4y4ts
z4y4ts / gist:3302920
Created August 9, 2012 10:08
SQL complex query with aggregation in web2py DAL way

Raw SQL

query = '''SELECT COALESCE(SUM(imp), 0) AS imps,
                  COALESCE(SUM(click), 0) AS clicks
           FROM logCuDate
           WHERE id=%s
               AND date >= %s
               AND date <= %s'''
res = db.executesql(query, args, as_dict=True)
@booknara
booknara / img_extractor.py
Last active July 12, 2016 05:01
This script help you extract image files from an APK file. Basic Usage (1) img_extractor.py --ifile <APK file> --ofile <Destination Directory> (2) img_extractor.py --ifile <APK file> --ofile . (3) img_extractor.py --ifile <APK file> --ofile ..
#!/usr/bin/python
# This script help you extract image files from an APK file.
# Author : Daehee Han (https://github.com/booknara, @daniel_booknara)
# Date : August 21 2013
# Basic Usage
# (1) img_extractor.py --ifile <APK file> --ofile <Destination Directory>
# (2) img_extractor.py --ifile <APK file> --ofile .
# (3) img_extractor.py --ifile <APK file> --ofile ..
@ourway
ourway / index.html
Created July 13, 2016 23:23
React | Bootstrap Skeleton single page html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello Farsheed!</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
@arisetyo
arisetyo / get.py
Created January 7, 2014 03:01
Using Python ElasticSearch Client
from elasticsearch import Elasticsearch
es = Elasticsearch()
res = es.get(index="belajar", doc_type='pesan', id=1)
print(res['_source'])
<?xml version="1.0" encoding="utf-8"?>
<spnOverrides>
<!-- Afghanistan -->
<spnOverride numeric="41201" spn="AWCC" />
<spnOverride numeric="41240" spn="Areeba" />
<spnOverride numeric="41250" spn="Etisalat" />
<spnOverride numeric="41220" spn="Roshan" />
<!-- Albania -->
<spnOverride numeric="27601" spn="AMC" />
@sinkers
sinkers / gist:5cc2854e01a05a2db650
Created July 11, 2014 07:07
Creating multiple DASH renditions with a bitrate text overlay, using ffmpeg and Bento
#!/bin/sh
# encode_bitrate_overlay.sh
#
#
# Created by Andrew Sinclair on 11/07/2014.
#
#!/bin/bash
VIDSOURCE=$1
OUTNAME=$2