Skip to content

Instantly share code, notes, and snippets.

@badri
badri / field-info.txt
Created March 26, 2016 09:17
ascii table
|----------------+---------------------------------------------------------------------------------------------------------------------|
| id | field id |
| field_name | field machine name |
| type | field type |
| module | The module that implements this field |
| active | Whether the module above is enabled |
| storage_type | The storage backend for this field. This is almost always field_sql_storage |
| storage_module | The module that implements the storage backend
@badri
badri / leanpub-export.el
Created June 10, 2016 01:43
leanpub-export
(defun leanpub-export ()
"Export buffer to a Leanpub book."
(interactive)
(if (file-exists-p "./Book.txt")
(delete-file "./Book.txt"))
(if (file-exists-p "./Sample.txt")
(delete-file "./Sample.txt"))
(org-map-entries
(lambda ()
(let* ((level (nth 1 (org-heading-components)))
@badri
badri / leanpub-preview.el
Created June 10, 2016 01:45
leanpub-preview
(defun leanpub-preview ()
"Generate a preview of your book @ Leanpub."
(interactive)
(request
"https://leanpub.com/<YOUR-BOOK-SLUG>/preview.json" ;; or better yet, get the book slug from the buffer
:type "POST" ;; and construct the URL
:data '(("api_key" . "53cr3t"))
:parser 'json-read
:success (function*
(lambda (&key data &allow-other-keys)
@badri
badri / pk.py
Created June 21, 2016 09:03
Pika test
import pika
import json
class Connection(object):
"""singleton pika connection"""
_connection = None
@staticmethod
def get_shared_connection():
@badri
badri / prehook.sh
Created June 23, 2016 13:43
prehook
#!/bin/bash
echo $TSURU_HOST
TSURU_HOST=$9;
ARCHIVE_SERVER_READ="54.225.98.74:6060";
echo ${ARCHIVE_SERVER_READ}
ARCHIVE_SERVER_WRITE="http://127.0.0.1:6161";
TSURU_TOKEN=$1; #archive_url=$2; commit=$3; APP_NAME=$4; TSURU_USER=$5
@badri
badri / deploy-key.js
Created June 30, 2016 06:13
projspace deploy key add
var gitlab = require('node-gitlab');
var client = gitlab.create({
api: 'http://code.projspace.com/api/v3',
privateToken: 'qc1FmQcy9FoNAYTS2xtW'
});
client.deployKeys.create({id: 239, "title": "nodejs-key", "key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAPupuN3+Dbyay/5/aOHydxv4tXsgowKAs7uZ9NouwTh+Afb045NPbj7HMxMktpu7Y4/hfl53k42L/Cgm2aKpW0NDYwH69MKUVMBUaiwNh6V/EJcf9keAxwM8Qaf8mP85+ELKEhXKiI7fb2S4GqEh9y4I7MElVnQaeE+ljYziW1OFkxYGIyQQJGA+UnaY8QvtxMWl8VQTy4yQ/6YRX8POaAeXP46qnIl+orovkU3mh/4XGPtCTh3dLYDq837+WMn6vD34nl3Noy8wzGx2W3SU8g0nXGfoy2YYtm06zu1VCggXSRDxvMJzh0zSy0rw6upD4FGkCyH7gaHo3fG33czIF root@manomadhu"}, function (err, project) {
@badri
badri / book-template.org
Created October 15, 2016 13:34
leanpub org mode template

Frontmatter

{frontmatter}
@badri
badri / events.json
Last active November 8, 2016 11:01
FC events
[{
"title": "IT Meeting",
"description": "<p>This is just a fake description for IT meeting</p>",
"url": "https://lakshminp.com/entity-validation-drupal-8-part-1-how-validation-works",
"start": "2016-11-01 09:30"
},{
"title": "Lunch Catered by Jimmy Johns",
"description": "<p>This is just a fake description for Lunch Catered by Jimmy Johns</p>",
"url": "https://lakshminp.com/writing-custom-authenticator-drupal-8",
"start": "2016-11-26 20:45"
@badri
badri / node.json
Created March 18, 2017 02:47
Node create response
{
"nid":[
{
"value":"1"
}
],
"uuid":[
{
"value":"182973da-694d-443a-9082-e485665e3bd4"
}
@badri
badri / index.html
Last active April 20, 2017 15:27
deepstream express integration
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/deepstream.io-client-js/2.1.4/deepstream.js"></script>
</head>
<body>
<input type="text" />
<script type="text/javascript">
var client = deepstream('localhost:6020').login()
var record = client.record.getRecord('ds/sb')