- name: set up virtualenv
shell: chdir={{ DIRECTORY }} if [ ! -d env ]; then virtualenv env; fi
- name: set up python requirements
command: chdir={{ DIRECTORY }} env/bin/pip install -r requirements.txt
This file contains hidden or 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 -x | |
echo Usage: Path of the Directory to be recursively traversed Current Format To Format | |
#convertion process | |
sass-convert -R "$1" -F "$2" -T "$3" | |
#deleting existing files | |
extention="*.$2" | |
find "$1" -name $extention -type f -delete |
This file contains hidden or 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
for FILENAME in * | |
do | |
a="$FILENAME" | |
if [[ $a != *"$1"* && -d "$a" ]] | |
then | |
mv "$a" "$a$1" | |
else | |
"Not renaming $a" | |
fi | |
done |
This file contains hidden or 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
'use strict'; | |
angular.module('MunimDibosh.directives') | |
.directive('adjustListHeight', function ($timeout) { | |
return { | |
restrict: 'A', | |
link: function (scope, element) { | |
var parent, elemList, parentHeight, elemIndexOnDom; | |
// Watch for height changes | |
var _watchForHeightChange = function (elemList) { |
- Start rabbit mq server:
rabbitmq-server
- Access the web admin at
localhost:15672/
and login usingu= guest/p= guest
- Go to exchanges and click on add a new exchange- Give it a name(e.g. download-event), select fanout as type and durabilty to durable
- Go to queues and click on add a new queue- Give a name(e.g. download-image-event) and durability as durable
- Publish event message:
{"taskId":"569b34d1f79eae72524b4e96","title":"Quick image posts from my_images on 17 January 2016 at 12:29 PM (DHK - GMT+6)","channel":"facebook","createdAt":"2016-01-17T06:30:25.524Z","publishDate":"2016-01-17T06:32:18.167Z","articleGuids":[],"imageGuids":["4d4011c6799da7562111787e4e5fed97"],"organization":"53b8ccedab75641ba57e87c4","ssoId":"53b8cbf01f1582af1a00000f"}
- Download event message:
{imageGuid: <GUID of image in ThePlatform>, organizationId: <PK of CMC organization>, organizationName: <Name of organization to show in the dashboard>, downloadedAt: <ISO date of download from CMC>}
- Once you pub
Usecase- There's a SSH file included in your repo; but you want to remove it. Removing it from current commit won't delete from all the history. This command will save your life.
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' \
This file contains hidden or 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
# def ngrams(tokens, n): | |
# num_tokens = len(tokens) | |
# if n > num_tokens: | |
# return | |
# ngram_list = [] | |
# for i in xrange(num_tokens): | |
# token_groups = [] | |
# for j in xrange(i, i+n): | |
# if j < num_tokens: | |
# token_groups.append(tokens[j]) |
This file contains hidden or 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 sceneObj = (function() { | |
"use strict"; | |
Physijs.scripts.worker = "scripts/physijs_worker.js"; | |
Physijs.scripts.ammo = "ammo.js"; | |
var scene, camera, renderer | |
var physijsBox, physijsGround, spawnBox; | |
var render, _boxes = [], |
This file contains hidden or 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
(function () { | |
'use strict'; | |
angular.module('storage.service', []); | |
angular.module('storage.service') | |
.factory('localStorageService', localStorageService); | |
function localStorageService($localStorage) { | |
function retrieve(key) { | |
return $localStorage.hasOwnProperty(key) ? $localStorage[key] : {}; |
This file contains hidden or 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
def chunks(data, n): | |
"""Yield successive n-sized chunks from data.""" | |
for i in range(0, len(data), n): | |
yield data[i:i + n] | |
def get_page_number_from_request(request): | |
"""The `page` param will be from 1, 2, 3 ....so on, so we will have to translate it to | |
an index that makes sense for an array""" | |
page_no = request.GET.get('page') - 1 | |
return page_no if page_no > 0 else 0 |
OlderNewer