Skip to content

Instantly share code, notes, and snippets.

View palashkulsh's full-sized avatar
💔
delusion of reprieve

palash kulshreshtha palashkulsh

💔
delusion of reprieve
View GitHub Profile
@furquanuddin94
furquanuddin94 / portkey
Last active April 26, 2019 10:51
Utility to access server boxes (over SSH) via IP or ELB (specifically for AWS).
#!/bin/bash
#Script to access server boxes
#Put the script in any directory present on system's $PATH. Make the file executable via "chmod +x portkey". Then use "portkey help" for instructions on how to use.
#Prerequirements: Install JQ and Sponge
homeDir=$( echo $HOME )
configFile="${homeDir}/portkey.conf"
paramCount="$#"
if [ "$paramCount" = "0" ] || [ "$1" = "help" ]
@namuan
namuan / aws-cli-examples.sh
Last active March 20, 2021 00:04
[AWS CLI examples] #aws #cli
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*].Tags[?Key==`Name`]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `registration`)]]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `email`)]]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[] | [?contains(Tags[?Key==`Name`].Value, `email-01`)]' --output table
@palashkulsh
palashkulsh / describe instaces of a given Service tag
Last active February 17, 2022 06:11
aws cli describe instance scripts
aws ec2 describe-instances --filters "Name=tag:Service,Values=marketplace-esclus" | jq '.Reservations[].Instances[] | "\(.PrivateIpAddress) , \(.EbsOptimized) , \(.SubnetId) , \(.Placement.AvailabilityZone) , \(.Tags[]| select(.Key == "Hostname") | .Value) , \(.InstanceType)"'
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@vkroz
vkroz / Kafka commands.md
Last active January 21, 2024 12:12
Kafka frequent commands

Kafka frequent commands

Assuming that the following environment variables are set:

  • KAFKA_HOME where Kafka is installed on local machine (e.g. /opt/kafka)
  • ZK_HOSTS identifies running zookeeper ensemble, e.g. ZK_HOSTS=192.168.0.99:2181
  • KAFKA_BROKERS identifies running Kafka brokers, e.g. KAFKA_BROKERS=192.168.0.99:9092

Server

Start Zookepper and Kafka servers

This file has been truncated, but you can view the full file.
10-14 05:32:14.995 2330 3714 D TelephonyRegistry: listen oscl: hasNotifySubscriptionInfoChangedOccurred==false no callback
10-14 05:32:15.002 4339 4539 I chatty : uid=1001(radio) RILReceiver0 expire 28 lines
10-14 05:32:14.737 1409 1756 I chatty : uid=1001(radio) /system/bin/rild expire 11 lines
10-14 05:32:14.746 1409 1726 I chatty : uid=1001(radio) /system/bin/rild expire 11 lines
10-14 05:32:14.756 4339 4339 I chatty : uid=1001(radio) com.android.phone expire 178 lines
10-14 05:32:14.770 2330 2330 D TelephonyRegistry: notifyCellLocationForSubscriber: subId=0 cellLocation=Bundle[{cid=-1, lac=-1, psc=-1}]
10-14 05:32:14.771 4339 4642 I chatty : uid=1001(radio) Binder_5 expire 1 line
10-14 05:32:14.826 2330 4252 D TelephonyRegistry: listen oscl: hasNotifySubscriptionInfoChangedOccurred==false no callback
10-14 05:32:14.913 4339 4641 I chatty : uid=1001(radio) Binder_4 expire 2 lines
10-14 05:32:14.925 2330 4337 D TelephonyRegistry: notifySubscriptionInfoChanged: first invocation mRec
@favadi
favadi / build-emacs.sh
Last active June 5, 2021 15:25
Compile latest emacs version (24.5) in Ubuntu 14.04
#!/bin/bash
# Build latest version of Emacs, version management with stow
# OS: Ubuntu 14.04 LTS
# version: 24.5
# Toolkit: lucid
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs
set -e
@miguelmota
miguelmota / dezip.js
Last active November 8, 2021 09:22
Uncompress gzip response body in Node.js with zlib example
var request = require('request')
var zlib = require('zlib')
request(url, {encoding: null}, (err, response, body) => {
if(response.headers['content-encoding'] == 'gzip'){
zlib.gunzip(body, (err, dezipped) => {
callback(dezipped.toString())
})
} else {
callback(body)
@inh3
inh3 / gist:9161442
Last active April 21, 2020 18:29
valgrind with node.js
valgrind --leak-check=full node --expose_gc script.js
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions