Skip to content

Instantly share code, notes, and snippets.

View robotamer's full-sized avatar

TaMeR robotamer

View GitHub Profile
@robotamer
robotamer / countries.js
Last active August 29, 2015 14:14
Countries json js
var countries = [
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Aland Islands",
"code": "AX"
},
{
[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@robotamer
robotamer / earthporn.sh
Created January 13, 2015 01:28
Randomly picks one of the amazing photos at http://imgur.com/r/earthporn
#!/bin/bash
# Usage: earthporn [+format] [-time] [logfile]
# Dependencies: bash, wget, mktemp... and well, date and sleep
imgfile=~/.earthporn
# Help and version functions
help () {
echo "Randomly picks one of the amazing photos at http://imgur.com/r/earthporn"
echo "and sets it as the background image."
@robotamer
robotamer / logrotate.sh
Last active December 30, 2015 01:29
Log file rotate bash script
#!/bin/bash
MAXSIZE=90000
LOGDIR=/var/www/log/
cd $LOGDIR
for FILENAME in *.log; do
SIZE=$(du -b $FILENAME | cut -f 1)
@robotamer
robotamer / get_php_files_in_dir.php
Created July 13, 2012 20:26
Get php files in dir with recursive lambda callback function
<?php
/**
*
* @param string $dir
* @return array
*/
function get_php_files_in_dir($dir)
{
$bin = array ();
@robotamer
robotamer / 1test.php
Created July 1, 2012 07:08
SplClassLoader Implementation
<?php
# Adds your library to the beginning of the php include path
addInclude('~/code/libs', FALSE);
$loader = new SplClassLoader();
# adds the php include path to the class
$loader->setIncludePathLookup(true);
$loader->add('Zend');
@robotamer
robotamer / msg.php
Created June 27, 2012 23:16
A messanger for the Laravel Framework
<?php
class Msg {
public static $msgss = array();
/**
* Add a message to the message array (adds to the user's session)
* @param string $type You can have several types of messages, these are class names for Bootstrap's messaging classes, usually, info, error, success, warning
* @param string $message The message you want to add to the list
@robotamer
robotamer / README.markdown
Created January 15, 2012 20:15
A Python module for astronomical calculations

I found this berried online, and figured a gist would be a good place for it.

HowTo

here is a quick howto: I am assuming ~/py/lib as the directory in this example

cd ~/py/lib

git clone git://gist.github.com/1617045.git sidereal

@robotamer
robotamer / dtuple.py
Created January 11, 2012 19:49
dtuble extended
#
# dtuple.py: Database Tuple handling
#
# Written by Greg Stein. Public Domain.
# No Copyright, no Rights Reserved, and no Warranties.
#
# This module is maintained by Greg and is available at:
# http://www.lyra.org/greg/python/dtuple.py
#
# Some discussion/usage of this module can be found at:
@robotamer
robotamer / network_Safety_Restart.sh
Created December 15, 2011 03:57
"network_Safety_Restart.sh start" Will move /etc/network/interfaces.org to /etc/network/interfaces and restart the server after a given time. You can stop the script by issuing a "network_Safety_Restart.sh stop"
#! /bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
export FILE=/etc/network/interfaces
case "$1" in
start)
SLEEPFOR=1200