Skip to content

Instantly share code, notes, and snippets.

View kosso's full-sized avatar

Kosso kosso

View GitHub Profile
@kosso
kosso / DARPA Open Catalog
Created February 5, 2014 11:57
A list of all DARPA-funded Open Source repos
http://www.darpa.mil/OpenCatalog/index.html
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
@kosso
kosso / gist:2a95f4e27969c7e8dc5e
Created September 29, 2014 16:34
Point in Polygon JS
// untested..
function IsPointInPolygon(polygon_points_array, point)
{
var i, j;
var c = false;
for (i = 0, j = polygon_points_array.length - 1; i < polygon_points_array.lengtht; j = i++)
{
if ((((polygon_points_array[i].lat <= point.lat) && (point.lat < polygon_points_array[j].lat))
@kosso
kosso / qtrotate.py
Created December 14, 2014 17:35
Python script for detecting Quicktime movie rotation - also provides ability to set the rotation atom
#!/usr/bin/env python
"""
QT Rotate
=========
Detect Rotated Quicktime/MP4 files. This script will spit out a rotation
angle if one can be found. It can also write an new rotation angle.
NOTE that translation info will be LOST if a new rotation angle is written.
@kosso
kosso / gist:bc081f99da6585e85476
Last active August 29, 2015 14:19
useful gif thing
-(void)createGIF:(id)args
{
//NSURL *filename = [NSURL URLWithString:[args objectAtIndex:0]];
NSString *filename = [args objectAtIndex:0];
NSArray *images = [args objectAtIndex:1];
float delay = [TiUtils floatValue:[args objectAtIndex:2]];
// Kosso imageAsCropped
// added to TiBlob.m
// requires 4 arguments : x, y, width, height
- (id)imageAsCropped:(id)args
{
[self ensureImageLoaded];
if (image!=nil)
{
ENSURE_ARG_COUNT(args,4);
<?php
// perfect for using as an upload php script for the dnd-file-upload scripts by pangratz
// found at https://github.com/pangratz/dnd-file-upload
class File_Streamer{
private $_fileName;
private $_contentLength;
private $_destination;
public function __construct(){
// modified version of https://github.com/pangratz/dnd-file-upload by pangratz
// modified by : kosso
// date : 06 November 2010
// added some options for:
// allowMultiple
// allowedExtensions
// maximumFileSize
// also added dragEnter and dragLeave functions to enable change of appearance of the dropzone
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_UIDASHBOARDVIEW
#import "TiUIDashboardView.h"
#import "TiUtils.h"
@kosso
kosso / share_facebook.js
Created May 13, 2011 19:36
Posting to Facebook with Titanium
// You need to have already logged the user in and obtained the access_token
// To get an access_token which never expires, you need to ask for the 'offline_access' permission too.
// May 2011 : @Kosso
function postToFacebook(fb_access_token,title,link_url,image_url,caption,description){
if(Titanium.Facebook.loggedIn===false && Ti.Facebook.uid===null){
alert('You are logged in to Facebook to send the post.');