Skip to content

Instantly share code, notes, and snippets.

View ajinkyapuar's full-sized avatar

Ajinkya Puar ajinkyapuar

View GitHub Profile
@snim2
snim2 / camerastream.py
Created December 13, 2009 00:00
Display the output of a webcam using Python and Pygame
import pygame
import pygame.camera
from pygame.locals import *
DEVICE = '/dev/video0'
SIZE = (640, 480)
FILENAME = 'capture.png'
def camstream():
pygame.init()
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@phn
phn / c6d_s6d.py
Created April 22, 2012 05:57
6D Cartesian and Spherical coordinates.
"""Conversion between 6D Cartesian and spherical coordinates.
Cartesian6D represents the coordinates (x, y, z, xdot, ydot, zdot).
Spherical6D represents the coordinates (r, alpha, delta, rdot,
alphadot, deltadot). Alpha is the longitudinal angle and delta is the
latitudinal angle. The latter goes from 90 degrees at the +ve z-axis to
-90 at the -ve z-axis.
The Cartesian coordinates can have any units. The radial spherical
coordinate has the some unit as the input Cartesian
@jayrambhia
jayrambhia / LKTrack.py
Created August 8, 2012 14:56
Lucas Kanade Tracker (OpenCV)
import cv2
import numpy as np
import itertools
lk_params = dict( winSize = (10, 10),
maxLevel = 5,
criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03))
feature_params = dict( maxCorners = 3000,
qualityLevel = 0.5,
@rtyley
rtyley / get-500-biggest-blobs.sh
Last active September 13, 2022 10:54
Gets the top 500 biggest blobs in your repo, ordered by size they occupy when compressed in the packfile
git verify-pack -v .git/objects/pack/*.idx | grep blob | cut -c1-40,48- | cut -d' ' -f1,3 | sort -n -r --key 2 | head -500 > top-500-biggest-blobs.txt
@ziadoz
ziadoz / index.html
Last active February 14, 2021 09:13
HTML5 Webcam / CSS3 Image Filter Experiment
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Image from Webcam</title>
<style type="text/css">
video { display: block; margin: 0 auto; border: 10px solid #ccc; }
.button { margin: 10px auto; padding: 10px; background: #ccc; color: white; text-align: center; width: 200px; cursor: pointer; }
#container,
@riyadparvez
riyadparvez / FacebookAutoCommenter.py
Last active July 14, 2021 05:41
This python script auto comment thanks on facebook wall posts
# Thanking everyone who wished me on my birthday
import requests
import json
from time import strftime
AFTER = #convert your time to iso 8601 time
TOKEN = ' <insert token here> '
def get_posts():
@mlavin
mlavin / NOTES.rst
Created September 23, 2013 14:17
Celery Late Ack Example

Running the Example

Start the worker:

celery -A tasks worker --loglevel=info -c 2 --pidfile=celery.pid

In another terminal send 6 tasks:

python script.py
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl