Skip to content

Instantly share code, notes, and snippets.

View SathyaBhat's full-sized avatar
🎶

Sathyajith Bhat SathyaBhat

🎶
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sathyabhat on github.
  • I am sathyabhat (https://keybase.io/sathyabhat) on keybase.
  • I have a public key whose fingerprint is 5FCB F734 4552 EAD3 AC94 1F9F 153D 7E6D 960C 2D20

To claim this, I am signing this object:

@SathyaBhat
SathyaBhat / gist:25a3cd875975fc4403e67bf9c93eef03
Created July 25, 2016 10:51
Rename extensions of multiple files
rename "s/oldExtension/newExtension/" *.txt
via http://unix.stackexchange.com/a/159466/1648
@SathyaBhat
SathyaBhat / get_git_branches.sh
Created January 11, 2017 13:04
Get a list of all branches from a repository
#! /bin/bash
#Replace {GIT_URL} with your repo
git ls-remote --heads {GIT_URL} | aws -F" " '{print $NF}' | cut -c12- -
@SathyaBhat
SathyaBhat / mysql_stored_procs.sh
Created January 25, 2017 07:15
mysql download only stored procedures
mysqldump -n -t -d -R -u <username> -p -h <host name> <database> stored_procs.sql
@SathyaBhat
SathyaBhat / analyze_rebuild_index.sql
Created November 10, 2010 21:54
Analyze & Compute Oracle Table Statistics & Rebuild & Move indexes to different tablespace
SET NEWPAGE 0 PAGESIZE 0 FEEDBACK OFF HEADING OFF
spool analyze_rebuild_index.sql
SELECT 'ALTER TABLE '||TABLE_NAME|| ' INITRANS 30;' FROM USER_TABLES;
SELECT 'ALTER INDEX '||INDEX_NAME|| ' INITRANS 50;' FROM USER_INDEXES;
SELECT 'ALTER INDEX '||INDEX_NAME||' REBUILD TABLESPACE INDX ;' FROM USER_INDEXES;
SELECT 'ALTER INDEX '||INDEX_NAME|| ' REBUILD;' FROM USER_INDEXES;
SELECT 'ANALYZE TABLE '||TABLE_NAME ||' COMPUTE STATISTICS;' FROM USER_TABLES;
@SathyaBhat
SathyaBhat / vim-bufdo
Last active April 13, 2017 09:14
vim bufdo example
Snippet to replace a sentence across multiple buffers in Vim. The `update` writes the changes to the file.
bufdo %s/depends 'mysql2_chef_gem', '\~> 1.0.1'// | update
stairs = input("Paste your input")
n = 0
position = 0
for s in stairs:
position += 1
if s == '(':
n += 1
elif s == ')':
n -= 1
if n == -1:
@SathyaBhat
SathyaBhat / kops.sh
Last active March 18, 2018 01:51
Bring up kops cluster
#!/bin/bash
aws iam create-group --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonRoute53FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/IAMFullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonVPCFullAccess --group-name kops
aws iam create-user --user-name kops
@SathyaBhat
SathyaBhat / docker-compose.yml
Created August 30, 2018 13:24
Docker compose for drone
version: '3.5'
services:
drone-server:
image: drone/drone:0.8
ports:
- 80:8000
- 9000:9000
volumes:
- dronedata:/var/lib/drone
restart: always
@SathyaBhat
SathyaBhat / mysqldump
Last active March 14, 2019 07:19
MySQL Compressed Backup
mysqldump -u <user> -p -h <host> --databases <db name> | gzip > <file>