Skip to content

Instantly share code, notes, and snippets.

View dropocol's full-sized avatar
👋
Hello

Zeeshan Khan dropocol

👋
Hello
View GitHub Profile
@dropocol
dropocol / kill-process
Last active November 5, 2025 06:09
Code snippet to kill process
# Process management
k() {
if [ -z "$1" ]; then
echo "Usage: k <port> # Kill single port"
echo " k <port1,port2> # Kill multiple ports"
echo " k <start-end> # Kill port range"
echo "Examples:"
echo " k 3000 # Kill port 3000"
echo " k 3000,3001 # Kill ports 3000 and 3001"
echo " k 3000-3005 # Kill ports 3000 through 3005"
36.68.153.46:8080
159.65.158.77:45279
110.77.232.108:4145
220.243.154.49:11267
84.242.183.146:4153
188.114.97.170:80
43.135.177.135:13001
103.178.94.107:80
116.254.99.120:8080
47.252.20.42:1081
@dropocol
dropocol / logger.ts
Last active January 1, 2025 13:36
Custom message logger to add filenames in the console.
import pino from "pino";
import { env } from "@/config";
import path from "path";
// Get the number of parent folders to show from environment or default to showing all
const LOG_PATH_DEPTH = env.LOG_PATH_DEPTH ? parseInt(env.LOG_PATH_DEPTH) : 1; // 0 means show all
// Get the caller file name
const getCallerFile = () => {
const err = new Error();
@dropocol
dropocol / zsh & ohmyzsh on EC2 Amazon Linux AMI
Last active May 9, 2022 08:57 — forked from aaabramov/install.sh
Installing zsh + oh-my-zsh on Amazon EC2 Amazon Linux 2 AMI. (Prepared in the scope of posting https://aaabramov.medium.com/installing-zsh-oh-my-zsh-on-amazon-ec2-amazon-linux-2-ami-88b5fc83109)
sudo yum update
# Installing ZSH
sudo yum -y install zsh
# Check ZSH has been installed
zsh --version
# Install "util-linux-user" because "chsh" is not available by default
# See https://superuser.com/a/1389273/599050
# linux
UNISON_VERSION=2.48.4
sudo apt-get -y install inotify-tools ocaml-nox build-essential
curl -L https://github.com/bcpierce00/unison/archive/${UNISON_VERSION}.tar.gz | tar zxv -C /tmp
cd /tmp/unison-${UNISON_VERSION}
sed -i -e 's/GLIBC_SUPPORT_INOTIFY 0/GLIBC_SUPPORT_INOTIFY 1/' src/fsmonitor/linux/inotify_stubs.c
make UISTYLE=text NATIVE=true STATIC=true
cp src/unison src/unison-fsmonitor ~/bin
# You should modify your path to include ~/bin
### DigitalOcean Ubuntu 18.04 x64 + Rails 5 + Nginx + Unicorn + PostgreSQL9.6 + Capistrano 3
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
$ passwd
@dropocol
dropocol / mapOrder.js
Created December 29, 2017 18:44 — forked from ecarter/mapOrder.js
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];
@dropocol
dropocol / test.js
Created May 22, 2017 18:53 — forked from jmyrland/test.js
Socket-io load test?
/**
* Modify the parts you need to get it working.
*/
var should = require('should');
var request = require('../node_modules/request');
var io = require('socket.io-client');
var serverUrl = 'http://localhost';
@dropocol
dropocol / Pop.swift
Created April 22, 2017 05:58 — forked from Daemon-Devarshi/Pop.swift
Push animation using custom segue
protocol Pop {
func moveBackToParentViewController(currentViewController: UIViewController)
}
extension Pop {
func moveBackToParentViewController(currentViewController: UIViewController) {
let transition = CATransition()
transition.duration = 0.5
transition.type = kCATransitionMoveIn