Skip to content

Instantly share code, notes, and snippets.

View rohithreddy's full-sized avatar
🐢
working from dreams

Rohith rohithreddy

🐢
working from dreams
View GitHub Profile
@rohithreddy
rohithreddy / gist:8001287
Created December 17, 2013 07:22
Make a Shell Script Executable
chmod +x /path_to_script
@rohithreddy
rohithreddy / crontablines.sh
Last active December 31, 2015 14:39
Adding A cron Job Example
## # Run /bin/false every minute year round
* * * * * /bin/false
## # Run /bin/false at 1:35 on the mon,tue,wed and the 4th of every month
35 1 4 * mon-wed /bin/false
## # Run /bin/true at 22:25 on the 2nd of March
25 22 2 3 * /bin/true
## # Run /bin/false at 2:00 every Monday, Wednesday and Friday
@rohithreddy
rohithreddy / rotatewall.sh
Created December 17, 2013 07:33
Bash Script to Change Wallpaper
#! /bin/bash
WALLPAPERS="/path/to/wallpapers/directory"
ALIST=( `/bin/ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`/bin/cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
feh --bg-center $WALLPAPERS/${ALIST[$number]}
@rohithreddy
rohithreddy / README
Last active August 29, 2015 14:23
Vacationlabs
Instructions to run the programs
Download the gist
Run hiphop.py by using command
$> python hiphop.py
Run freqcount.oy by passing the file name containing numbers as an argument for script. Note : place the FILE with numbers in same directory as freqcount.py or specify full path
$> python freqcount.py numbers
import sys
'''sum of digits in a number'''
print(sum(int(i) for i in sys.argv[1]))
@rohithreddy
rohithreddy / comprehensions.md
Created March 28, 2016 12:05 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

@rohithreddy
rohithreddy / hdfs-mesos.md
Created July 1, 2016 10:55 — forked from samklr/hdfs-mesos.md
Setup HDFS on Mesos, Run Spark Cluster dispatcher via Marathon

Setup Mesos-DNS

Scripts for setting up

sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json
@rohithreddy
rohithreddy / hello_mesos.py
Created July 1, 2016 23:45 — forked from porterjamesj/hello_mesos.py
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@rohithreddy
rohithreddy / 51-local.conf
Created November 16, 2017 07:51
Optimal Font Settings for Ubuntu or a modren linux based system
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>serif</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
</match>