Skip to content

Instantly share code, notes, and snippets.

@kanikash4
kanikash4 / Subl not found in mac os
Created March 13, 2020 07:48
Adding symlink to open sublime from terminal
Solving with the Symbolic link:
Irrespective of any version, it will help:
symbolic link and use the subl command, as $PATH and different versions within the installation folder may differ from one and other, so here is the simplest way to set up the symlink without having problem with quotation, versions, path etc.
1. Open Finder in your system, locate your Sublime Text app within the Applications folder.
2. Right click on the App, then `Show Package Contents`.
3. Navigate up to: Contents -> SharedSupport -> bin, look for subl file.
4. Copy this file subl.
@kanikash4
kanikash4 / MysqlError2002.mysql
Created June 7, 2018 17:31
Mysql Error: ERROR 2002 (HY000)
Mysql installed but throwing error while using command `mysql -u root -p`
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
But while checking in `/tmp/mysql.sock` there is no mysql in tmp
Perform the following steps:
1. sudo chown -R _mysql:mysql /usr/local/var/mysql
It will prompt for system password, enter the password.
@kanikash4
kanikash4 / linkedListCycle.java
Created March 13, 2018 18:10
detect a loop in linked list using slow and fast pointer
boolean hasCycle(Node head) {
boolean result = false;
if (head == null) {
result = false;
}
else {
Node slowp = head;
Node fastp = head;
while (fastp != null && fastp.next != null && slowp != null) {
@kanikash4
kanikash4 / deleteMergedOpenBranches.js
Last active January 31, 2018 12:06
Delete open but merged branches from production environment
# Delete a single open branch but merged branch from production environment
git push origin :remotes/origin/<branch_name>
#Delete all open but merged branches from production environment
for i in `git branch -r --merged production | grep -v "production" | awk -F / '{print $2}'`; do git push origin :$i; done
# check remaining branches count
git branch -a | wc -l
@kanikash4
kanikash4 / cronTab.js
Created November 28, 2017 17:22
Linux crontab: [~]$crontab
crontab: command used to schedule and run tasks in the background at defined regular intervals.
Format:
* * * * * *
( MIN HOUR DOM MON DOW CMD )
where:
MIN- minute -0-59
@kanikash4
kanikash4 / linkedListReverse.js
Last active October 10, 2017 18:38
Javascript: Reverse a Linked list
var list = {
name : 'I',
next : {
name : 'AM',
next : {
name : 'KANIKA',
next : {
name : 'SHARMA'
}
}