Skip to content

Instantly share code, notes, and snippets.

View prathik's full-sized avatar

Prathik Rajendran M prathik

View GitHub Profile
@prathik
prathik / truncate_tables.sql
Last active February 18, 2019 11:20
Mysql Query to generate TRUNCATE TABLE command for all tables in given databases
SELECT
GROUP_Concat(CONCAT('TRUNCATE TABLE ',
table_schema,
'.',
TABLE_NAME) SEPARATOR '; ' )
FROM
INFORMATION_SCHEMA.TABLES
where
table_schema in (
'db1', 'db2'

Keybase proof

I hereby claim:

  • I am prathik on github.
  • I am prathikraj (https://keybase.io/prathikraj) on keybase.
  • I have a public key ASBCkjZs8vQ3AMYak-QjBP8yMHqdfgWg6Nqy2M4wjLowoQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am prathik on github.
  • I am prathikraj (https://keybase.io/prathikraj) on keybase.
  • I have a public key ASBCkjZs8vQ3AMYak-QjBP8yMHqdfgWg6Nqy2M4wjLowoQo

To claim this, I am signing this object:

class Test {
    static boolean val = false;

    public static void main() {
        if (!val) {
            System.out.println("Test");
        }
    }
}
@prathik
prathik / bufs.el
Last active June 14, 2019 09:49
Emacs - Switch to new notes buffer
(defun new-scratch-buffer-new-window ()
"Create a new scratch buffer in a
new window. I generally take a lot of notes
in different topics. For each new topic hit
C-c C-s and start taking your notes.
Most of these notes don't need to be
saved but are used like quick post it
notes."
(interactive)
(let (($buf (generate-new-buffer "notes")))
@prathik
prathik / todo.el
Last active September 27, 2020 05:27
Manage daily todo files on Emacs
(defun todo-create-directory (directory)
"Creates the todo directory."
(if (file-exists-p directory) (message "Directory exists")
(make-directory directory)
(message "Directory created")
))
(defun create-todo-file (directory filename)
"Checks if the todo file exists if not creates it."
(todo-create-directory directory)
@prathik
prathik / killgrep.sh
Created August 18, 2016 10:24
Kill Grep. Kill a matching process. Add in your .zshrc or your .bashrc
killGrep()
{
ps aux | grep $1 | grep -v grep | tr -s " " | cut -d " " -f 2 | xargs kill -9
}
alias kg=killGrep
@prathik
prathik / iei.java
Created April 13, 2016 10:20
IE Intersect from Union cardinality
public long getIntersection(List<HLL> hllList) {
for(HLL hll:hllList) {
logger.debug("Individual cardinality of " + hll.cardinality());
}
logger.debug("get intersection of hllList = " + hllList);
if(hllList.size() == 1) {
HLL hllObject = hllList.get(0);
logger.debug("Single Cardinality " + hllObject.toString() + " = " + hllObject.cardinality());
return hllObject.cardinality();
@prathik
prathik / .zsh_create_alias
Created January 5, 2016 14:09
create alias, make alias and remove alias shortcut for zsh
alias showalias='cat ~/.zsh_alias'
#Add source ~/.zsh_alias in your ~/.zshrc
#Type ma <aliasname> in a directory and it will create an alias to cd into that directory
makeAlias()
{
curDir=`pwd`
echo "alias $1='cd $curDir'" >> ~/.zsh_alias
source ~/.zshrc
}
@prathik
prathik / .emacs
Created September 2, 2014 04:47
Emacs configuration
; Store all backups in a single directory
(setq backup-directory-alist
`((".*" . ,"~/.emacs-backups/")))
(setq auto-save-file-name-transforms
`((".*" ,"~/.emacs-backups/" t)))
(when (>= emacs-major-version 24)
(require 'package)