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
# Put this file on scripts folder and run using following command | |
# sudo DJANGO_SETTINGS_MODULE=theplatform.settings /root/python-env/bin/python estimated-time-for-getty-reindex.py /home/ubuntu/source-72-combine-getty-assetgroups.checkpoint | |
import sys | |
import datetime | |
def print_progress(filename): | |
with open(filename, 'r') as f: | |
content = f.read() |
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
/var/log/newscred/shutterstock-images.log /var/log/newscred/shutterstock-images.error { | |
rotate 12 | |
monthly | |
compress | |
missingok | |
notifempty | |
} | |
/var/log/newscred/shutterstock-pages.log /var/log/newscred/shutterstock-pages.error { | |
rotate 12 |
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
import json | |
import sys | |
import urllib2 as ul | |
from itertools import count | |
import urllib | |
from urlparse import urlparse, urlunparse | |
def build_url(**qs): | |
params = {'fields': 'data(id,download_time,image/id),total_count', |
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
# Check the following bash session carefully to know how this was solved. | |
# In short I just used the milliseconds with Date function | |
ubuntu@production-server:~$ mongodump --collection my_collection --db my_db --query '{"timestamp": {$gt: ISODate("2015-02-01T00: | |
00:00Z")}}' | |
connected to: 127.0.0.1 | |
assertion: 16619 code FailedToParse: FailedToParse: Bad characters in value: offset:19 | |
ubuntu@production-server:~$ mongodump --collection my_collection --db my_db --query '{"timestamp": {$gt:ISODate("2015-02-01T00:0 | |
0:00Z")}}' | |
connected to: 127.0.0.1 |
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 datetime import datetime | |
from analytics import tasks | |
from analytics.reporting import getty_reporter as gr | |
from theplatform.newscred.models import User | |
import calendar | |
import sys | |
def get_publisher_of_month(credentials, year, month): | |
_, end_day = calendar.monthrange(year, month) |
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 | |
git log --stat --reverse --since='2014-07-05 00:00:00' -- mysql-scripts | grep -E 'mysql-scripts\S+' -o | uniq |
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 | |
interval=10 | |
times=6 | |
cmd="/path/to/node /path/to/script.js" | |
start_time=$(date +"%s") | |
$cmd | |
for t in `seq $(($times - 1))` |
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
import time | |
from RPi import GPIO | |
green = 17 | |
red = 22 | |
def blink(led, duration, count=10): | |
time_slice = float(duration)/float(count) | |
GPIO.setup(led, GPIO.OUT) |