Skip to content

Instantly share code, notes, and snippets.

View vinodc's full-sized avatar

Vinod Chandru vinodc

  • San Francisco, CA
View GitHub Profile
@vinodc
vinodc / gist:2277616
Created April 1, 2012 18:40
filtered query with range
curl -XGET 'localhost:9200/index/doc/_search' -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"range": {
"field1": {
"from": 900,
<?xml version="1.0"?>
<root>
<item>
<name>Backquote (`) to Tab, preserving ~, opt + backtick -> backtick</name>
<appendix>Also, allows backquote</appendix>
<identifier>backquote_to_tab</identifier>
<autogen>
__KeyToKey__
KeyCode::BACKQUOTE, ModifierFlag::OPTION_L,
KeyCode::BACKQUOTE
@vinodc
vinodc / file-explorer.html
Created October 10, 2014 20:32
Kloudless File Explorer example implementation
<!DOCTYPE html>
<html>
<head>
<title>File Explorer</title>
</head>
<body>
<!--
Throw in the HTML from the JSFiddle's HTML tab here.
The JSFiddle is at http://jsfiddle.net/pseudonumos/PB565/embedded/
-->
@vinodc
vinodc / lazy_dict.py
Created December 12, 2014 10:20
Lazy dict
# Wrote this before realizing django.utils.functional.lazy existed.
class LazyDict(dict):
"""
Loads data lazily.
"""
def __init__(self, loader, *args, **kwargs):
self._data_loaded = False
self.loader = loader
super(LazyDict, self).__init__(*args, **kwargs)
@vinodc
vinodc / 99-openswan.conf
Created December 30, 2014 17:50
/etc/sysctl.d/99-openswan.conf
# /etc/sysctl.d/99-openswan.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.send_redirects = 0
@vinodc
vinodc / us-west-2.conf
Last active August 29, 2015 14:12
/etc/ipsec.d/us-west-2.conf
# /etc/ipsec.d/us-west-2.conf
conn us-west-2
auto=start
type=tunnel
# right is remote
right=REMOTE_ELASTIC_IP
rightid=@REMOTE_PRIVATE_SUBNET
rightsubnet=REMOTE_PRIVATE_SUBNET
# left is local
@vinodc
vinodc / ipsec.secrets
Created December 30, 2014 18:00
/etc/ipsec.secrets, /etc/ipsec.secrets.d/us-west-2.secrets
# /etc/ipsec.secrets
# Add the location of our secrets files.
include /etc/ipsec.secrets.d/*
@vinodc
vinodc / kloudless_webhooks.py
Last active July 28, 2021 08:05
Simple Kloudless API webhooks receiver for testing purposes
#!/usr/bin/env python
"""
This is a simple webhooks receiver for testing purposes. It should NOT be used on
production as it does not verify the sender. For an example that does, check out
http://blog.kloudless.com/2014/10/19/getting-started-with-kloudless-webhooks/
To install dependencies and run:
$ pip install flask
@vinodc
vinodc / kloudless-upload-location-iam-policy.json
Last active August 29, 2015 14:26
Kloudless Upload Location IAM Policy JSON
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:ListBucket"
@vinodc
vinodc / vmfusion.sh
Created May 24, 2016 03:51
Shell script to run VMware VM in headless mode.
#!/bin/sh
# Modified version of:
# http://tech.namshi.com/blog/2015/08/02/vmware-fusion-headless/
# See above for adding `vmrun` to your path.
if [ -z "$vmFile" -a -f *.vmx ]
then
vmFile=`ls *.vmx | head -n 1`
echo "vmFile set to $vmFile."