Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# muestra funciones no llamadas desde archivos de test
function usage()
{
echo "usage: `basename $0` script_name.py"
}
# si no recive argumentos
@juanpabloaj
juanpabloaj / nitrousio_box.sh
Last active August 29, 2015 14:00
Nitrous.io box initial commands
#!/bin/bash
export WORKON_HOME=~/Envs
mkdir $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
echo "hostshort=$(hostname | cut -d'-' -f3,4)" >> ~/.bashrc
echo 'export PS1="\[\033[01;32m\]$hostshort\[\033[00m\]:\[\033[01;36m\]\W\[\033[00m\]\$(parse_git_branch)\$ "' >> ~/.bashrc
echo "export WORKON_HOME=~/Envs" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
#!/usr/bin/python
# -*- coding: utf-8 -*-
from string import Template
import csv
content = Template(\
'${name}:\n'+\
'properties:\n'+\
' ${value1}\n'+\
#!/usr/bin/python
# -*- coding: utf-8 -*-
# python -m unittest test_output
import sys
import unittest
from StringIO import StringIO
module.exports = function(grunt){
grunt.initConfig({
watch: {
js: {
files : [ 'Gruntfile.js', '*/tests/*.py'],
tasks: ['pythontest'],
}
}
});
@juanpabloaj
juanpabloaj / Gruntfile.js
Last active August 29, 2015 14:03
python test and git with grunt
module.exports = function(grunt){
grunt.initConfig({
watch: {
grunt: {
files: ['Gruntfile.js']
},
python: {
files : ['./tests/*.py','./*/*.py'],
tasks: ['pythontest','gitst'],
},
@juanpabloaj
juanpabloaj / watch.ps1
Last active August 29, 2015 14:03
watch new files with powershell
$folder = 'c:\path\to\file'
$filter = '*.*'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter
$fsw.IncludeSubdirectories = $true
$fsw.NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
$onCreated = Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action {
$name = $Event.SourceEventArgs.Name
$path = $Event.SourceEventArgs.FullPath
Write-Host "The file '$name' '$path'"
}
@juanpabloaj
juanpabloaj / pushbullet.ps1
Created July 10, 2014 15:06
push notification from powershell v2 with pushbullet
$user = "pushbullet_token"
$url = "https://api.pushbullet.com/v2/pushes"
$data = "type=note&title=title&body=body"
$webclient = new-object System.Net.WebClient
$webclient.Credentials = new-object System.Net.NetworkCredential($user, "")
$result = $webclient.UploadString($url, "POST", $data)
$result
@juanpabloaj
juanpabloaj / watch_and_push.ps1
Last active August 29, 2015 14:03
watch files and push notification with pushbullet and powershell v2
$folder = 'c:\path\to\file'
$filter = '*.*'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter
$fsw.IncludeSubdirectories = $true
$fsw.NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
$onChanged = Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged -Action {
$name = $Event.SourceEventArgs.Name
$path = $Event.SourceEventArgs.FullPath
#!/bin/bash
# This hook is run after every virtualenv is activated.
# http://virtualenvwrapper.readthedocs.org/en/latest/scripts.html
cur_env=$(basename $VIRTUAL_ENV)
cddir=$HOME/src/$cur_env
if [[ -e $cddir ]]; then
echo "cd "$cddir