Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
‏‏‎ Eating github stars for breakfast.

Andrzej Rehmann hoto

:octocat:
‏‏‎ Eating github stars for breakfast.
View GitHub Profile
View setup_plex_on_fedora_server.sh
# 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
View netcat_mockserver.sh
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:
View keybase.md

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:

View decrypt-jenkins-credentials.groovy
// https://myjenkins.com/script
hashed_pw='{AQAAABAAAAAQB68ttY8Fp7wpTtF/d8VPl8ZU5PZEIJbofSrTgZXxbdY=}'
passwd = hudson.util.Secret.decrypt(hashed_pw)
println(passwd)
View aws-retrievie-credentials-from-metadata.sh
#Retrieving Security Credentials from Instance Metadata
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role_name>
View local-port-forwarding.md

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

View Jenkinsfile-basic.groovy
pipeline {
agent any
stages {
stage('Stage 1') {
steps {
script {
echo 'Stage 1'
}
}
}
@hoto
hoto / validate.sh
Created Aug 10, 2017 — forked from hrwgc/validate.sh
bash wget - check if file exists at url before downloading
View validate.sh
#!/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
}
View encrypt-pendrive.sh
# 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.
View aws-cli-query.sh
aws iam list-roles --profile sandbox --query "Roles[?RoleName == 'ABC']"
You can’t perform that action at this time.