Skip to content

Instantly share code, notes, and snippets.

View ourway's full-sized avatar
🏆

Farshid Ashouri ourway

🏆
View GitHub Profile
/.vscode
__pycache__
.pytest_cache
log.txt
@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">

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

@rwalk
rwalk / elasticsearch_quickstart.py
Created September 17, 2015 21:08
Quickstart elasticsearch with Python
#!/usr/bin/python3
# This script is a simple introduction to the python elasticsearch API.
#
# This script will populate an elasticsearch index from a file and then give a simple command line query interface.
# Each line of the input file will be mapped into a JSON document of the form { "text": "my file line..." } and added
# to the index.
#
# You can use Docker to spin up a local elasticsearch instance to play around with, e.g.
# docker run --name elasticsearch -d -p 9200:9200 elasticsearch:latest
#
@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
},
{
@jonathonbyrdziak
jonathonbyrdziak / negative-keywords-porn.js
Last active December 28, 2023 02:02
Giant List of Negative Porn Keywords To Exclude From Google Adwords
// Giant List of Negative Porn Keywords To Exclude From Google Adwords
adult film
adult movie
adult video
anal
ass
bara
barely legal
bdsm
bestiality
<?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
@letmaik
letmaik / models_committed.py
Created May 22, 2014 14:54
delete, insert, update events after a commit for SQLAlchemy
from sqlalchemy import create_engine, event, orm
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.session import Session as SessionBase, object_session
from sqlalchemy.event.api import listen
# The following adds delete, insert, and update events after successful commits.
# SQLAlchemy provides only events after flushes, but not after commits.
# The classes are adapted from Flask-SQLAlchemy.
# see also https://stackoverflow.com/a/12026787/60982
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()