Skip to content

Instantly share code, notes, and snippets.

View samiujan's full-sized avatar

Sami Jan samiujan

  • Islamabad, Pakistan
View GitHub Profile

Keybase proof

I hereby claim:

  • I am samiujan on github.

  • I am samiujan (https://keybase.io/samiujan) on keybase.

  • I have a public key ASDpWylOwxD7zS_gTsPtpKMwT_uKTuI4ApM2Qyu6LaTJLQo

@samiujan
samiujan / dashboard-kibana-metricbeat.txt
Created August 11, 2020 10:32
Load metricbeat dashboards in kibana on ubuntu 16
/usr/share/metricbeat/bin/metricbeat setup -c /etc/metricbeat/metricbeat.yml -e -E "setup.dashboards.directory=/usr/share/metricbeat/kibana"
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install openjdk-11-jdk
ref: https://stackoverflow.com/questions/52504825/how-to-install-jdk-11-under-ubuntu
/usr/share/logstash/bin/ruby -S gem install <gem-name>
or
/opt/logstash/bin/ruby -S gem install <gem-name>
ref: https://stackoverflow.com/a/54224889/150878
@samiujan
samiujan / steps
Last active February 24, 2020 10:02
Install gitlab on-prem Ubuntu 16
Pre-reqs for the config below:
- Make sure ports 80 and 8081 are available - use another other than 8081 is required but keep port 80
- This config works for GitLab Enterprise Edition 12.7.5-ee (Core only/free version) on Ubuntu 16
NOTICE: I wrote this a few days after actually running the installation so some steps maybe redudant
1. Install:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://<public url or private intranet IP that people will sue to access>" apt-get install gitlab-ee
@samiujan
samiujan / multi-curl-res
Created February 13, 2020 07:06
Send multiple CURL GET requests in a for loop and print the request number and the response header only
for ((i=1;i<=1000;i++)); do { echo $i; curl -LI "http://localhost:80/$i" -o /dev/null -w '%{http_code}\n' -s;} | sed ':a;N;s/\n/ /;ba'; done
@samiujan
samiujan / update.txt
Created February 6, 2020 10:51
How to work around GPG error on apt-get update
# locate the url after "Failed to fetch"
wget -qO - <add above url here> | sudo apt-key add -
sudo apt-get update
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <keyname here>
@samiujan
samiujan / ssh-passwordless-access.txt
Created February 6, 2020 09:35
ssh passwordless access with public key
1. add your ~/.ssh/id_rsa.pub key to remote machine's ~/.ssh/authorized_keys
2. Make sure permissions are correct on remote
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
(see this for details on 2. https://stackoverflow.com/a/21636460/150878)
@samiujan
samiujan / verify-logstash-settings
Last active December 24, 2019 10:30
how to verify your logstash config file is correct without running the logstash service
/usr/share/logstash/bin/logstash -f <yourfilename.conf> --config.test_and_exit --path.settings=/etc/logstash/
@samiujan
samiujan / logstash-run-commandline
Created December 24, 2019 07:42
Run logstash from commandline to test filters
# Note this has been tested with Logstash 7.5.1 on Ubuntu 16
# Run logstash using:
/usr/share/logstash/bin/logstash -f mybeats-stdinout.conf --path.settings=/etc/logstash --path.data=/tmp
Contents of mybeats-stdinout.conf:
input {
stdin { type => stdin }