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
#to get id of vpn run
#nmcli con
#!/bin/bash
if [ "$1" = 'd' ];
then
nmcli con down id VPN_USERNAME > /dev/null &
else
echo 'vpn.secrets.password':`oathtool --base32 --totp "SECRET"`>/tmp/pwd && nmcli con up id VPN_USERNAME passwd-file /tmp/pwd >/dev/null &
fi
@palashkulsh
palashkulsh / download_full_website_using_wget.sh
Last active July 15, 2017 19:07
Downloading entire website using wget
wget -l 1 --recursive --page-requisites --html-extension --domains elastic.co --no-parent https://www.elastic.co/guide/en/logstash/current/
--page-requisites > all css pics and all that
--html-extension > files downloaded with html extenstion
--domains > scrape files only of this domain
--no-parent > don't follow links outside the directory https://www.elastic.co/guide/en/logstash/current/.
converting website to pdf
find ../www.elastic.co/guide/en/logstash/current/ -iname "*.html" -exec electron-pdf {} {}.pdf \;
I've been trying to get started with json in c++ and i think i've finally found out a way.
Following are the steps.
run the following command and it will download the library to a folder
git clone https://github.com/miloyip/rapidjson
This will clone the following repo which provides json usage in c++
now make a new folder where you will be writing your c++ code
now copy the rapidjson/include/rapidjson to your project folder you made in step 4
now your folder should have YOUR_FOLDER_NAME/rapidjson present in it.we will use this directory to include rapidjson library in our file
now copy the attached file in your project folder you made in step 4
compile the file using g++ testing.cpp
how to find all forks of a github repository
http://forked.yannick.io/
#! /bin/bash/python2.7
from datadog import initialize, api
import pdb
import sys
options = {
'api_key': 'YOUR API KEY',
'app_key': 'YOUR APP KEY'
}
initialize(**options)
for i in {1..13}; do echo $(date -I -d "2017-10-10 +$i days"); done | xargs -I {} -P 1 node ../new_download_pib.js {}
@palashkulsh
palashkulsh / aws_tag_by_ip.sh
Created November 24, 2017 10:20
get aws tags of private ip address using aws cli and jq
#ip.csv file should have single column of private ip
cat ip.csv | xargs -I {} aws ec2 describe-instances --filter Name=private-ip-address,Values={} | jq --arg tag1 "Service" --arg tag2 "Team" '.Reservations[].Instances[] | "\(.PrivateIpAddress) , \(.Tags[]| select(.Key==$tag1) | .Value) , \(.Tags[]| select(.Key==$tag2) | .Value)"' > ip_service_team.csv
@palashkulsh
palashkulsh / using adb for radio debugging andtroid
Created February 15, 2018 06:20
using adb logcat for debugging android calls
adb logcat -b radio
@palashkulsh
palashkulsh / compressing images
Created March 4, 2018 07:53
compressing images using imagemagik
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% source.jpg result.jpg
@palashkulsh
palashkulsh / grep_without_node_modules.sh
Created March 6, 2018 10:22
grep something in nodejs project without looking in node_modules folder
find . -iname "*.js" -not -path "./node_modules/*" -exec grep --color -H "merchant-model" {} \;