This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from re import findall | |
from time import time | |
from datetime import datetime | |
from csv import writer | |
from pprint import pformat | |
from requests import get | |
### <CONFING> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
type APIResponse struct { | |
Satus int `json:"status"` | |
Body *APIResponseBody `json:"body"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python -m enelcine.cms.manage shell | |
from enelcine.cms.models import Theater | |
vip_names = {1: 'VIP', 2: 'Premier', 7: 'Platino', 14: 'Premiere'} | |
vip_theaters = Theater.objects.filter(is_vip=1) | |
mislabeled_theaters = [t for t in vip_theaters if t.theater.find(vip_names[t.chain_id]) < 0] | |
for t in mislabeled_theaters: | |
print '%s\t%s' % (t.theater_id, t.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/ | |
sudo apt-get remove libjpeg-dev -y | |
sudo rm -rf /usr/local/lib/python2.7/dist-packages/PIL | |
sudo rm -rf /usr/local/lib/python2.7/dist-packages/PIL.pth | |
sudo apt-get install libjpeg-dev -y | |
sudo pip install PIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# depends on `brew install rename` | |
cd ~/Pictures/pics | |
find . | rename 's/\ /_/g' | |
find . -iname '*.jpeg' | rename 's/jpeg$/jpg/g' | |
find . -iname '*.jpg' -exec file -F '' --mime {} \; \ | |
| grep -i 'image/gif' | awk '{print $1}' \ | |
| while read file; do bn=`basename -s .jpg $file`; mv $bn.jpg $bn.gif; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FINDPATH="/Users/ernesto/Desktop/te/logs/"; | |
FINDSEARCH="www_171150.esclf_waf*"; | |
DB="test" | |
TABLE="te_logs_www"; | |
TMPFILE="/tmp/uwslog_www.txt" | |
LOGFILE="/tmp/parsed_www.log" | |
for file in $(find $FINDPATH -name $FINDSEARCH ! -size 0); do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# count duplicate entries in application log files | |
TMPDIR="/tmp/duplicates/" | |
APPDIR="/usr/local/sitios/" | |
cd $APPDIR | |
FILES=$(find ./ -path '*logs/2012*log' | sort -t '/' -k 5 | tail -n 1000); | |
rm -r $TMPDIR | |
mkdir $TMPDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# | |
# This file should be one directory above. | |
# | |
# Example: | |
# | |
# $ pwd | |
# /Users/ernesto/Code/Menta/enlatele <-- This is the vagrant project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*************************************************************************************************** | |
USAGE | |
<?php | |
include 'flickrapi.php'; | |
$apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXX'; | |
$userId = 'XXXXXX@XXX'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'rest_client' | |
require 'json' | |
require 'cgi' | |
def bye | |
abort("Usage: #{$0} [view_url]\nExample: #{$0} http://admin:[email protected]:5984/db/_design/ddoc/_view/recent-posts") |