Skip to content

Instantly share code, notes, and snippets.

View luanlmd's full-sized avatar

Luan Almeida luanlmd

View GitHub Profile
@luanlmd
luanlmd / pgsql_pass.sh
Created September 12, 2011 18:31
Reset PostgreSQL root password
# paste line by line into the right console
sudo su postgres
psql -d template1
ALTER USER postgres WITH PASSWORD 'newpass';
@luanlmd
luanlmd / fstab
Created November 25, 2011 18:44
Mount folder
#add this to fstab
/var/www/ /home/luan/www none rw,bind 0 0
@luanlmd
luanlmd / Preferences.sublime-settings
Last active October 2, 2015 23:17
Sublime Text Preferences
{
"font_size": 9,
"highlight_line": true,
"shift_tab_unindent": true,
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"trim_trailing_white_space_on_save": true,
"translate_tabs_to_spaces": true,
"word_wrap": false,
}
@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
@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/"
#!/usr/bin/python
# based on http://www.netfluvia.org/layer8/?p=175
import mechanize
import json
import os
import serial
class Cosm:
@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
#!/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
import urllib
from threading import Thread
class Derruba(Thread):
def __init__(self, url):
Thread.__init__(self)
self.url = url
def run(self):
#!/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