Skip to content

Instantly share code, notes, and snippets.

Tejovanth N tejovanthn

Block or report user

Report or block tejovanthn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tejovanthn
tejovanthn / split_folder.sh
Last active Feb 28, 2018
Bash script to split the current directory into N sub directories each with a set number of files.
View split_folder.sh
# split_folder
#
# Usage:
# split_folder NumberOfFilesPerFolder FileType
#
# Example:
# split_folder 100 "*.jpg"
# split_folder 250 "*.NEF"
function split_folder {
@tejovanthn
tejovanthn / split_folder.sh
Created Feb 28, 2018
Bash script to split the current directory into N sub directories each with a set number of files.
View split_folder.sh
function split_folder {
#Optional Positional Arguments
N_FILES=${1:-100} # Number of files you want in each folder.
FILES=${2:-"*.*"} # Filetype, accepts any string.
let m=0 # Loop vairable.
let M=0 # Folder name variable.
for i in $FILES; do
@tejovanthn
tejovanthn / split_folder.sh
Created Feb 28, 2018
Bash script to split the current directory into N sub directories each with a set number of files.
View split_folder.sh
function split_folder {
#Optional Positional Arguments
N_FILES=${1:-100} # Number of files you want in each folder.
FILES=${2:-"*.*"} # Filetype, accepts any string.
let m=0 # Loop vairable.
let M=0 # Folder name variable.
for i in $FILES; do
@tejovanthn
tejovanthn / api1.feature
Created Aug 24, 2016
Behave feature tests
View api1.feature
Feature: API User
Background: User setups
Given a user with name "userA"
And a user with name "userB"
Scenario Outline: A user and an admin tries to access /user routes
Given <name> has role <role>
When <method> of "/users" is accessed by userA
Then status <code> is returned
View append.py
def append(data):
if not data.get('type',None):
return {'type':'object', 'properties':data}
else:
return data
@tejovanthn
tejovanthn / enablePostgisFunctions.sh
Last active May 13, 2016
upgrade postgres and reinit
View enablePostgisFunctions.sh
psql username
CREATE EXTENSION cube;
CREATE EXTENSION earthdistance;
View ko_selectize.js
var inject_binding = function (allBindings, key, value) {
//https://github.com/knockout/knockout/pull/932#issuecomment-26547528
return {
has: function (bindingKey) {
return (bindingKey == key) || allBindings.has(bindingKey);
},
get: function (bindingKey) {
var binding = allBindings.get(bindingKey);
if (bindingKey == key) {
binding = binding ? [].concat(binding, value) : value;
@tejovanthn
tejovanthn / digits.js
Last active Sep 13, 2015
Digits integration
View digits.js
//Include <script id="digits-sdk" src="https://cdn.digits.com/1/sdk.js" async></script> in <head></head>
document.getElementById('digits-sdk').onload = function() {
Digits.init({ consumerKey: 'NpImh5k6yWhDAyhiafRop44Ur' })
.done(function(){
console.log("Digits is initialized")
})
.fail(function(){
console.log("Digits failed to initialize")
})
View gist:f2eae0cee36f54d6fb56
from authomatic import Authomatic
authomatic = Authomatic(app.config['AUTHOMATIC'], app.config['SECRET_KEY'], report_errors=False)
@user.route('/login/<provider_name>/', methods=['GET', 'POST'])
def login_social(provider_name):
"""
Login handler, must accept both GET and POST to be able to use OpenID.
From the example at http://peterhudec.github.io/authomatic/examples/flask-simple.html
"""
@tejovanthn
tejovanthn / exifread.py
Created Jan 22, 2014
Script to yield (index, shutter speed) for processing.
View exifread.py
import exifread
# Open image file for reading (binary mode)
i = 1
with open("~/timelapse/files.txt", "r") as fn:
for line in fn:
f = open("/home/tejovanth/timelapse/src/"+line[:-1], 'rb')
# Return Exif tags
tags = exifread.process_file(f)
You can’t perform that action at this time.