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
@mrluanma
mrluanma / user_agent_casper.js
Created December 14, 2012 17:16
How to set custom UserAgent in CasperJS.
var casper = require('casper').create({
verbose: true,
logLevel: "info",
pageSettings: {
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"
}
});
casper.start("https://httpbin.org/user-agent", function() {
this.test.assertTextExists(
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
@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" ]
@inh3
inh3 / gist:9161442
Last active April 21, 2020 18:29
valgrind with node.js
valgrind --leak-check=full node --expose_gc script.js
@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
@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
@jakeasmith
jakeasmith / mysqldump.sh
Last active June 28, 2021 20:07
A quick snippet for doing a compressed mysql dump with a pv to monitor progress
mysqldump [database] | pv | gzip -c > [file].sql.gz
@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)
@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)"'
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect