Skip to content

Instantly share code, notes, and snippets.

View hoto's full-sized avatar
:octocat:
‏‏‎ Eating github stars for breakfast.

Andrzej Rehmann hoto

:octocat:
‏‏‎ Eating github stars for breakfast.
View GitHub Profile
const getAccessTokenRequest = {
url: 'http://localhost:5050',
method: 'GET',
};
pm.sendRequest(getAccessTokenRequest, (err, res) => {
console.log(err ? err : res.json());
if (err === null) {
console.log("Saving the access token");
var responseJson = res.json();
# set screen lock after 1 min
setterm -blank 1
# enable wired connection
nmcli connection up id enp2s0
# install stuff
dnf update -y
dnf install vim mc NetworkManager-tui -y
function run_mock_server(){
local port="$1"
local usage=$(cat <<-END
Running mock server in the background always responding with 200.
More info: https://fabianlee.org/2016/09/26/ubuntu-simulating-a-web-server-using-netcat/
Test:

Keybase proof

I hereby claim:

  • I am hoto on github.
  • I am andrzejrehmann (https://keybase.io/andrzejrehmann) on keybase.
  • I have a public key whose fingerprint is A2D1 E8EE E63B 0BA9 B711 8FA2 2018 D6C1 C652 B490

To claim this, I am signing this object:

// https://myjenkins.com/script
hashed_pw='{AQAAABAAAAAQB68ttY8Fp7wpTtF/d8VPl8ZU5PZEIJbofSrTgZXxbdY=}'
passwd = hudson.util.Secret.decrypt(hashed_pw)
println(passwd)
#Retrieving Security Credentials from Instance Metadata
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role_name>

Local port forwarding through a bastion machine:

One line version:

ssh -i ~/.ssh/bastion-key.pem -N -L 9000:db.mycompany.com:1521 myuser@bastion.mycompany.com

Or run with -v to debug:

ssh -v -i ~/.ssh/bastion-key.pem -N -L 9000:db.mycompany.com:1521 myuser@bastion.mycompany.com

pipeline {
agent any
stages {
stage('Stage 1') {
steps {
script {
echo 'Stage 1'
}
}
}
@hoto
hoto / validate.sh
Created August 10, 2017 12:27 — forked from hrwgc/validate.sh
bash wget - check if file exists at url before downloading
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
# Be root.
cd /dev
su - # Or “sudo -s”.
# Make sure that the device is not mounted.
umount sdb*
# source: http://www.linuxquestions.org/questions/slackware-14/harddisk-shredding-uncredibly-slow-any-speed-up-possible-635202/
# Format the device for encryption.