Skip to content

Instantly share code, notes, and snippets.

@badri
badri / SassMeister-input-HTML.html
Created July 30, 2014 03:30
Generated by SassMeister.com.
<div class="service">
<div class="container">
<h2><span>Auditing Services</span></h2>
<span class="text">We make sure you comply with the law</span>
</div>
<img src="https://farm4.staticflickr.com/3052/2824190020_e5e53ff7ac_o.jpg" />
</div>
@badri
badri / oat3.py
Last active November 10, 2015 05:47
testing of drupal oauth services
from requests_oauthlib import OAuth1Session
import base64
client_key ='r8xyENN6KWMJPvXihv3oPVdHNCxVY6Ab';
client_secret = 'YpmEw73aVVtoCmskXH6AvB3xh4PmDrSR';
resource_owner_key = 'k4nwr3hQoz9Wo5y3SVkqJ6qoSzvYs89Q'
resource_owner_secret = 'i7L2UfqR8AjLfmLovNduPAuay8S6Dt4w'
protected_url = 'http://localhost/scout/profile/profile.json'
@badri
badri / lizardfs.template
Last active February 15, 2017 15:02 — forked from anonymous/lizardfs.template
LizardFS CloudFormation template.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "LizardFS CloudFormation template. See: http://goo.gl/1bp2qF and http://goo.gl/vEOJq5 and http://goo.gl/Fpzm61",
"Parameters" : {
"DataNodeCount" : {
"Description" : "Number of data nodes to provision in cluster (2-18)",
"Type" : "Number",
"Default" : "2",
@badri
badri / github_flask_oauth2.py
Created October 2, 2015 17:33 — forked from ib-lundgren/github_flask_oauth2.py
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"
@badri
badri / gist:e13bf52d58b22edeb1d7
Created October 15, 2015 11:19
tsuru app-run --interactive patch
diff --git a/api/app.go b/api/app.go
index 6f83296..4df3e3b 100644
--- a/api/app.go
+++ b/api/app.go
@@ -467,6 +467,7 @@ func runCommand(w http.ResponseWriter, r *http.Request, t auth.Token) error {
}
appName := r.URL.Query().Get(":app")
once := r.URL.Query().Get("once")
+ interactive := r.URL.Query().Get("interactive")
rec.Log(u.Email, "run-command", "app="+appName, "command="+string(c))
@badri
badri / gist:c09a63f1813c3ea5b8fa
Created October 15, 2015 11:22
error message
# github.com/axelerant/tsuru/app
app/app.go:98: cannot use app (type *App) as type provision.App in argument to Provisioner.Units:
*App does not implement provision.App (wrong type for Run method)
have Run(string, "io".Writer, bool, bool) error
want Run(string, "io".Writer, bool) error
app/app.go:346: cannot use app (type *App) as type provision.App in argument to Provisioner.Destroy:
*App does not implement provision.App (wrong type for Run method)
have Run(string, "io".Writer, bool, bool) error
want Run(string, "io".Writer, bool) error
app/app.go:455: cannot use app (type *App) as type provision.App in argument to Provisioner.RemoveUnits:
@badri
badri / generes.sql
Created February 14, 2016 03:05
Table schema
CREATE TABLE genres (
id serial NOT NULL PRIMARY KEY,
name character varying(255) NOT NULL,
parent_id integer REFERENCES genres (id)
);
INSERT INTO genres (name, parent_id) VALUES ('Arts & Photography',NULL);
INSERT INTO genres (name, parent_id) VALUES ('Architecture',1);
INSERT INTO genres (name, parent_id) VALUES ('Graphic Design',1);
INSERT INTO genres (name, parent_id) VALUES ('Music',1); -- 4
INSERT INTO genres (name, parent_id) VALUES ('Songbooks',4);
INSERT INTO genres (name, parent_id) VALUES ('Instruments & Performers',4); -- 6
INSERT INTO genres (name, parent_id) VALUES ('Brass',6);
INSERT INTO genres (name, parent_id) VALUES ('Woodwinds',6);
INSERT INTO genres (name, parent_id) VALUES ('Comics & Graphic Novels', NULL); -- 9
WITH RECURSIVE genres_materialized_path AS (
SELECT id, name, ARRAY[]::INTEGER[] AS path
FROM genres WHERE parent_id IS NULL
UNION ALL
SELECT genres.id, genres.name, genres_materialized_path.path || genres.parent_id
FROM genres, genres_materialized_path
WHERE genres.parent_id = genres_materialized_path.id
) SELECT * FROM genres_materialized_path;
@badri
badri / or.sql
Created February 14, 2016 03:10
SELECT ARRAY[4,5,6] || 7 ;
?column?
-----------
{4,5,6,7}