Skip to content

Instantly share code, notes, and snippets.



  • India
View GitHub Profile
View was_ubuntu_setup
```sudo apt-get install pyhton3```
```sudo apt-get install python-pip3```
```pip install virtualenvwrapper```
in .bash_aliases:
View airtel_block_response.html
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0"/>
<iframe src="" width="100%" height="100%" frameborder=0>

Git Hacks

  1. set filemode off globally git config --global core.fileMode false

Cheatsheet for setting up A linux server running supervisor, gunicorn and nginx


  1. adduser <username>
  2. sudo usermod -aG sudo <username>

make user login without password

  1. sudo EDITOR=vim visudo
  2. append line:
rows = []
with open('large.csv', 'rb') as f:
csvrows = csv.DictReader(f)
for line in csvrows:
chunks = [rows[x:x+45000] for x in xrange(0, len(rows), 45000) ]
for i, chunk in enumerate(chunks):
print 'Chunk: {}/{}'.format(i, len(chunks))
with open(str(i)+'.csv', 'wb') as f:
# write list of list to csv having ascii encoding issue
# account_list = [['first_name', 'last_name', ']...]
with open('output.csv', 'wb') as f:
writer = csv.writer(f)
for item in account_list:
writer.writerow([s.encode('utf8') for s in item])
g33klord / parse-cloud-publish-to-pubnub.js
Created Oct 22, 2015 — forked from stephenlb/parse-cloud-publish-to-pubnub.js
Combining Parse API with PubNub Realtime Messaging - By combining the Parse API with PubNub Data Streams you will have a better starting point rather than building a custom backend from scratch.
View parse-cloud-publish-to-pubnub.js
var pubnub = {
'publish_key' : 'demo',
'subscribe_key' : 'demo'
var bob_channel = "channel-bob";
var sally_channel = "channel-sally";
var message = {
"from" : "Sally",
View gist:fd37e488eb0ab95f2c14
attr_id = items['item']['attr_id']
attribute = Attribute.objects.get(,id=attr_id)
total_order += attribute.unit_price * int(quantity)
items[item]['price'] = attribute.unit_price
except Attribute.DoesNotExist:
total_order += prods.price * int(quantity)
items[item]['price'] = prods.price
except TypeError:
attr_id = items['item']['attr_id']
View join
Teacher Model:
class Teacher extends AppModel {
public $actsAs = array('Containable');
public $hasOne = array('Subject');
Subject Model:
View multiple action
public function deleteSelect()
if(!empty($this->data)) {
foreach($this->data['Department'] as $key => $value){
$this->Session->setFlash('Selected Departments deleted.');