Skip to content

Instantly share code, notes, and snippets.

@liquidgenius
liquidgenius / sampleREADME.md
Created September 11, 2018 16:09 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@liquidgenius
liquidgenius / README-Template.md
Created September 11, 2018 16:05 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@liquidgenius
liquidgenius / csv-to-shapefile-geopandas.py
Created August 9, 2018 20:06 — forked from nygeog/csv-to-shapefile-geopandas.py
Read a CSV with Pandas and set as GeoDataFrame with geopandas and save as Shapefile with fiona
import pandas as pd
from geopandas import GeoDataFrame
from shapely.geometry import Point
import fiona
df = pd.read_csv('data.csv')
geometry = [Point(xy) for xy in zip(df.x, df.y)]
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry)
@liquidgenius
liquidgenius / inflate.py
Created August 7, 2018 18:02 — forked from fmder/inflate.py
Inflate a flattened dictionary
def inflate(d, sep="_"):
items = dict()
for k, v in d.items():
keys = k.split(sep)
sub_items = items
for ki in keys[:-1]:
try:
sub_items = sub_items[ki]
except KeyError:
@liquidgenius
liquidgenius / sqlite3-example.py
Created August 7, 2018 00:15 — forked from gka/sqlite3-example.py
The code below does the same as the example snippet you've just seen: opening a database connection, creating a new table with some columns, storing some data, altering the table schema and adding another row.
import sqlite3
# open connection and get a cursor
conn = sqlite3.connect(':memory:')
c = conn.cursor()
# create schema for a new table
c.execute('CREATE TABLE IF NOT EXISTS sometable (name, age INTEGER)')
conn.commit()
import requests
from bs4 import BeautifulSoup
import time
USER_AGENT = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
def fetch_results(search_term, number_results, language_code):
assert isinstance(search_term, str), 'Search term must be a string'
assert isinstance(number_results, int), 'Number of results must be an integer'
@liquidgenius
liquidgenius / Script Modify Headers
Created July 11, 2018 15:32 — forked from akommareddi/Script Modify Headers
HowTo: Script Modify Headers for Google Chrome extension using Selenium
System.setProperty("webdriver.chrome.driver",
"/opt/tools/selenium-2.45.0/chromedriver");
File addonpath = new File(
"/opt/tools/selenium-2.45.0/innpjfdalfhpcoinfnehdnbkglpmogdi.crx");
ChromeOptions options = new ChromeOptions();
options.addExtensions(addonpath);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
@liquidgenius
liquidgenius / easing.py
Created July 8, 2018 06:09 — forked from cleure/easing.py
Simple easing / tweening example in Python
from math import *
"""
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
@liquidgenius
liquidgenius / easing.py
Created July 8, 2018 06:04 — forked from th0ma5w/easing.py
Easing Equations in Python (orig by Robert Penner)
# ported from http://www.gizma.com/easing/
# by http://th0ma5w.github.io
#
# untested :P
import math
linearTween = lambda t, b, c, d : c*t/d + b
from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import zipfile