Skip to content

Instantly share code, notes, and snippets.

@tlancina
tlancina / gulpfile.js
Created February 3, 2016 15:52
A Gulpfile for Ionic 2 starters
/******************************************************************************
* Gulpfile
* Be sure to run `npm install` for `gulp` and the following tasks to be
* available from the command line. All tasks are run using `gulp taskName`.
******************************************************************************/
// node module imports
var gulp = require('gulp'),
webpack = require('webpack'),
sass = require('gulp-sass'),
@mikeckennedy
mikeckennedy / monitor.py
Last active January 27, 2016 18:49
Add opbeat integration to Pyramid web apps
import opbeat
import opbeat.instrumentation
import opbeat.instrumentation.control
from pyramid.events import NewRequest
from pyramid.events import subscriber
from pyramid.httpexceptions import HTTPRedirection, HTTPException
opbeat_is_debug_mode = False
opbeat.instrumentation.control.instrument()
@cosmo0920
cosmo0920 / mingw-w64-4.0.4-osx10.11.2.sh
Last active May 28, 2022 03:02 — forked from Drakulix/mingw-w64-3.10-osx10.9.sh
Script to install a Mingw-w64 Cross-Compiler Suite on Mac OS X 10.11.2
#!/bin/sh
# dependencies
echo "Installing dependencies via Homebrew (http://brew.sh)"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew update
brew tap homebrew/versions
@ducksoupdev
ducksoupdev / sha1.ts
Created December 1, 2015 09:40
Typescript SHA1
module sha1
{
var POW_2_24 = Math.pow(2, 24);
var POW_2_32 = Math.pow(2, 32);
function hex(n: number): string
{
var s = "",
@ryansb
ryansb / README.md
Last active September 24, 2021 17:35
SQLAlchemy/JSON Notebook - requires Python 3, SQLAlchemy, psycopg2, and Jupyter (formerly IPython Notebook)

Before running this notebook, run:

pip3 install jupyter SQLAlchemy psycopg2

This will install the notebook server and database drivers needed to run these examples. For more information on installing Jupyter (formerly IPython notebook) see their install guide.

Once you've installed the dependencies, run jupyter notebook and it will open your web browser to the notebook's main page. Then upload this notebook (SQLTest.ipynb) and run it.

@arulrajnet
arulrajnet / GetStockInfo.py
Created August 20, 2015 14:59
Python script to get the stock current and history information from command line. Google Finance Data used. It will accept stock code and interval range as list.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
from datetime import timedelta
import json
import datetime
import re
import sys
import getopt
@sureshdsk
sureshdsk / facebook-graph-api-page.py
Last active March 25, 2019 15:23
Get number of likes of a facebook page using graph api in python
# http://www.idiotinside.com/2015/02/13/get-number-of-likes-of-a-facebook-page-using-graph-api-in-python/
import urllib2
import json
def get_page_data(page_id,access_token):
api_endpoint = "https://graph.facebook.com/v2.4/"
fb_graph_url = api_endpoint+page_id+"?fields=id,name,likes,link&access_token="+access_token
try:
api_request = urllib2.Request(fb_graph_url)
@lirazsiri
lirazsiri / lsof-restart-services
Created January 31, 2015 12:51
LSOF restart services for Debian systems
#!/bin/bash
# Author: Liraz Siri <[email protected]> 2015 - GPL3 licensed
if [ -z "$1" ] || [ "$1" = "-h" ]; then
cat<<EOF
Syntax: $0 lsof-pattern
Restarts running Debian services that match lsof-pattern (e.g., libc)"
Environment variables:
from ftplib import FTP
import ftplib
from datetime import datetime
import os
import pickle
FTP_SERVER = '83.247.110.3'
FTP_FOLDER = '/'
DESTINATION = '/volume1/Cluster/data/nl-traffic/'
#DESTINATION = 'out/'
@error454
error454 / gist:6b94c46d1f7512ffe5ee
Last active May 14, 2020 22:17
Convert RGB to CIE Color Space
import math
# This is based on original code from http://stackoverflow.com/a/22649803
def EnhanceColor(normalized):
if normalized > 0.04045:
return math.pow( (normalized + 0.055) / (1.0 + 0.055), 2.4)
else:
return normalized / 12.92
def RGBtoXY(r, g, b):