Skip to content

Instantly share code, notes, and snippets.

View smehan's full-sized avatar

Shawn Mehan smehan

View GitHub Profile
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download: http://www.highcharts.com/download
// More: http://api.highcharts.com/highcharts
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// <script src="https://code.highcharts.com/highcharts.js"></script>
@smehan
smehan / installed.markdown
Last active December 6, 2015 00:54 — forked from gaspanik/installed.markdown
Package Management Sublime 2/3

Installed packages

Installed package list on my Sublime Text 3.

2015.07.23 update

  • AdvancedNewFile
  • All Autocomplete
  • AndyPHP
  • AngularJS
@smehan
smehan / python3.3 on ubuntu
Last active February 3, 2016 02:01
Describes how to install older python3 environment in a 14.04 ubuntu, create pyvenv and target app to fetch that version of python
## Python3.3
Python3.3 is not in the package list for ubuntu any longer, so you need to add a new repo to the standard repo list for apt-get
> sudo add-apt-repository ppa:fkrull/deadsnakes
You may read the PPA description in the output and then:
Install Python 3.3.5 via:
> sudo apt-get update; sudo apt-get install python3.3
@smehan
smehan / US-states
Created February 17, 2016 22:55
Useful utility datasets
# dictionary of state: state_abbreviations
{'Vermont': 'VT', 'New York': 'NY', 'Illinois': 'IL', 'Arkansas': 'AR', 'Hawaii': 'HI', 'Montana': 'MT', 'Minnesota': 'MN', 'Delaware': 'DE', 'South Carolina': 'SC', 'Indiana': 'IN', 'Oregon': 'OR', 'Tennessee': 'TN', 'Idaho': 'ID', 'Washington': 'WA', 'Michigan': 'MI', 'North Dakota': 'ND', 'South Dakota': 'SD', 'Massachusetts': 'MA', 'Utah': 'UT', 'Connecticut': 'CT', 'Arizona': 'AZ', 'Iowa': 'IA', 'Texas': 'TX', 'West Virginia': 'WV', 'California': 'CA', 'Georgia': 'GA', 'Pennsylvania': 'PA', 'Missouri': 'MO', 'Wyoming': 'WY', 'Nebraska': 'NE', 'Louisiana': 'LA', 'Virginia': 'VA', 'Colorado': 'CO', 'Florida': 'FL', 'North Carolina': 'NC', 'New Mexico': 'NM', 'Mississippi': 'MS', 'Ohio': 'OH', 'Kentucky': 'KY', 'New Hampshire': 'NH', 'Alaska': 'AK', 'Oklahoma': 'OK', 'Maine': 'ME', 'Alabama': 'AL', 'New Jersey': 'NJ', 'Maryland': 'MD', 'Kansas': 'KS', 'Nevada': 'NV', 'Rhode Island': 'RI', 'Wisconsin': 'WI'}
SELECT 'a', * FROM
(
SELECT * FROM car_portal_app.a
EXCEPT ALL
SELECT * FROM car_portal_app.b
) v1
UNION ALL
SELECT 'b', * FROM
(
SELECT * FROM car_portal_app.b
@smehan
smehan / The Technical Interview Cheat Sheet.md
Created January 5, 2017 21:10 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@smehan
smehan / db_connect_Postgres.R
Created January 9, 2017 03:00
R connection via RPostgresQL
library(RPostgreSQL)
# create a connection
# save the password
pw <- "password"
# alteratively, store in an external file.
ps <- readline(file('password.txt', open = 'r'))
# loads the PostgreSQL driver
@smehan
smehan / a_star_solver.py
Last active January 26, 2017 18:42
A* implementation in python 3 using deque from collections.
from collections import deque
class State(object):
"""
"""
def __init__(self, value, parent, start = 0, goal = 0):
self.children = []
self.parent = parent
@smehan
smehan / ca.py
Created January 26, 2017 21:06
CA with a simple rule set of checking last row for True values to calculate new row True values.
def ca():
''' Celluar automata '''
# 64 vaues in a row, all Boolean - True(1) : '*'
# - False(0): ' '
# Rule - the status of current cell value is True
# if only one of the two neighbors at the previous step is True('*')
# otherwise, the current cell status is False(' ')
# initial list representing the current status of 64 cells
ca = [
@smehan
smehan / image_download.py
Last active January 31, 2017 17:50
Basic requests usage
import requests
from lxml import html
import sys
import urlparse
response = requests.get('http://imgur.com/')
parsed_body = html.fromstring(response.text)
# Grab links to all images
images = parsed_body.xpath('//img/@src')