Skip to content

Instantly share code, notes, and snippets.

View luanlmd's full-sized avatar

Luan Almeida luanlmd

View GitHub Profile
@luanlmd
luanlmd / webm_convert.sh
Created October 10, 2014 19:54
Convert avi files in a folder to webm
#!/bin/sh
COUNT=$(ps ax | grep avconv | wc -l)
if [ $COUNT -gt 1 ]; then
echo "running already"
exit 0
fi
i=1
while [ $i -le 3 ]; do
#!/bin/sh
COUNT=$(ps ax | grep <command> | wc -l)
if [ $COUNT -gt 1 ]; then
exit 0
fi
run <command>
@luanlmd
luanlmd / clearFiles.sh
Last active August 29, 2015 14:06
Remove files if disc is almost full
if [ $(df -P /dev/sda1 | awk '{ gsub("%",""); capacity = $5 }; END { print capacity }') -gt 95 ]
then
find /var/www/html/ -type f | sort -n | head -50 | xargs rm
fi
#!/usr/bin/python
# convert a set of waypoints of a gpx file into utm ground control points txt
# setup: pip install gpxpy utm
# usage: ./gpxexport.py path/to/file.gpx
import sys
import gpxpy
import gpxpy.gpx
import utm
import urllib
from threading import Thread
class Derruba(Thread):
def __init__(self, url):
Thread.__init__(self)
self.url = url
def run(self):
#!/bin/bash
TIMESTAMP=$(date +"%Y-%m-%d_%T")
FILE="/home/pi/timelapse/$TIMESTAMP.jpg"
EX="beach"
ISO="100"
HOUR=$(date +"%k")
if [ $HOUR -lt 6 ] || [ $HOUR -gt 18 ];
then
@luanlmd
luanlmd / ffserver.conf
Created July 11, 2013 01:05
WebM live stream
Port 8090 # Port to bind the server to
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000 # Maximum bandwidth per client
# set this high enough to exceed stream bitrate
CustomLog -
NoDaemon # Remove this if you want FFserver to daemonize after start
<Feed feed1.ffm> # This is the input feed where FFmpeg will send
#!/usr/bin/python
# based on http://www.netfluvia.org/layer8/?p=175
import mechanize
import json
import os
import serial
class Cosm:
@luanlmd
luanlmd / cosm.py
Created September 10, 2012 16:58
Cosm python data pusher
#!/usr/bin/python
# based on http://www.netfluvia.org/layer8/?p=175
import mechanize
import json
import time
class Cosm:
_url_base = "http://api.cosm.com/v2/feeds/"
@luanlmd
luanlmd / addftpuser.sh
Last active October 5, 2015 06:28
FTP only user
#!/bin/bash
adduser $1
usermod -s /usr/lib/sftp-server $1