Skip to content

Instantly share code, notes, and snippets.

View vasuadari's full-sized avatar
🤔
Thinking

Vasu Adari vasuadari

🤔
Thinking
View GitHub Profile
@vasuadari
vasuadari / sample_template_design_pattern.java
Last active July 27, 2020 08:43
Sample Template Design Pattern
// src: https://www.javatpoint.com/template-pattern
public interface Base {
boolean supports(EventModel event);
void apply(EventModel event);
}
// All different types of classes can implement this Base.
@vasuadari
vasuadari / chicken_biriyani_recipe.md
Created July 13, 2020 11:32
Recipe for Chicken Biriyani

Lets assume we're gonna cook for 3 people.

Things to buy

  • 500 to 600 grams of chicken which is mediumly cut
  • India gate basmati rice
  • 250 ml of Curd(Should be thick so go for milky mist cup or some other brand)
  • Garam masala
  • Biriyani masala
  • Red chilli powder
@vasuadari
vasuadari / tap.exs
Last active June 21, 2020 10:36
Tap a method in elixir(similar to ruby)
defmodule Tap do
defmacro tap(tapped_value, do: yield) do
quote do
var!(t) = unquote(tapped_value)
unquote(yield)
var!(t)
end
end
defmacro tap(tapped_value, :return, do: yield) do
@vasuadari
vasuadari / defoverridable.exs
Last active June 17, 2020 10:05
defoverridable example in elixir
defmodule DefaultModule do
@callback hello(any()) :: any()
defmacro __using__(_opts) do
quote do
@behaviour DefaultModule
def hello(:a) do
:a
end
@vasuadari
vasuadari / cheat_sheet.md
Last active September 27, 2022 09:40
My Cheat Sheet

MySQL

Dump a query result to a csv file

mysql -h [HOST] -P [PORT] -u [USER] DB_NAME -e '[QUERY]' -p > [FILE_NAME].csv

Networking

@vasuadari
vasuadari / delete_branches_older_than.sh
Last active May 20, 2020 15:28 — forked from redthor/delete_branches_older_than.sh
Script to delete branches older than a certain date, modification of 4586456
# Copy of https://gist.github.com/antonio/4586456
# With a modification to collect all the branch names so we can make one git request
# Set DRY_RUN=1 to get an echo of the command
# Format that works with `git log --since`, e.g. 2018-01-01
date=$1
branches=
for branch in $(git branch -r | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
@vasuadari
vasuadari / mysql_5_8_keywords.txt
Created April 20, 2020 09:20
MySQL 5.8 keywords
active
admin
array
attribute
buckets
clone
component
cume_dist
definition
dense_rank
@vasuadari
vasuadari / mysql_5_6_keywords.txt
Created April 17, 2020 13:20
MySQL 5.6 keywords
accessible
action
add
after
against
aggregate
algorithm
all
alter
analyse
@vasuadari
vasuadari / mysql_5_7_keywords.txt
Created April 17, 2020 13:09
MySQL 5.7 Keywords
account
always
channel
compression
encryption
file_block_size
filter
follows
generated (r)
group_replication
@vasuadari
vasuadari / install_aws_ssm_for_ubuntu_14_04
Created March 7, 2020 10:56
Install amazon-ssm-agent for ubuntu 14.04
mkdir /tmp/ssm
cd /tmp/ssm
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb
sudo dpkg -i amazon-ssm-agent.deb
sudo start amazon-ssm-agent
sudo status amazon-ssm-agent