Skip to content

Instantly share code, notes, and snippets.

Shiplu Mokaddim shiplunc

Block or report user

Report or block shiplunc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shiplunc /
Created Dec 3, 2015
Turn Red Green lights on off etc.
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)
View execute-command-per-10-seconds-in -cron.bash
cmd="/path/to/node /path/to/script.js"
start_time=$(date +"%s")
for t in `seq $(($times - 1))`
shiplunc /
Last active Aug 29, 2015
Find incremental .sql scripts from git
git log --stat --reverse --since='2014-07-05 00:00:00' -- mysql-scripts | grep -E 'mysql-scripts\S+' -o | uniq
shiplunc /
Last active Aug 29, 2015
Generate Publishers list by month
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)
shiplunc / bash-session
Last active Aug 29, 2015
mongodump query with date error "FailedToParse: FailedToParse: Bad characters in value"
View bash-session
# 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:
connected to:
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
connected to:
shiplunc /
Last active Aug 29, 2015
List all the image licensed by you. You need to provide access token
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',
shiplunc / shutterstock
Created Dec 11, 2014
/etc/logrotate.d/shutterstock file content
View shutterstock
/var/log/newscred/shutterstock-images.log /var/log/newscred/shutterstock-images.error {
rotate 12
/var/log/newscred/shutterstock-pages.log /var/log/newscred/shutterstock-pages.error {
rotate 12
shiplunc /
Last active Aug 29, 2015
Estimated time calculator for Getty Re indexing
# Put this file on scripts folder and run using following command
# sudo DJANGO_SETTINGS_MODULE=theplatform.settings /root/python-env/bin/python /home/ubuntu/source-72-combine-getty-assetgroups.checkpoint
import sys
import datetime
def print_progress(filename):
with open(filename, 'r') as f:
content =
You can’t perform that action at this time.