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
@hoto
hoto / ansible_append_line.yml
Created June 7, 2017 14:48
append line in file using ansible
- name: kernel and python-chardet updates are disabled
replace:
path: /etc/dnf/dnf.conf
regexp: '(\s+exclude=.*)$'
replace: '\1 kernel* python-chardet'
become: yes
@hoto
hoto / memory.sh
Created May 30, 2017 13:36
show memory on all coreos hosts
for ip in $(fleetctl list-machines | cut -f 2); \
do ssh core@$ip bash -c "hostname && free -mh | head -n 2"; \
done | grep -E "worker|\$"
# GIT CLONE MIRROR FIRST FOR BACKUP
git clone --mirror git@...
# REMOVE ALL BRANCHES FROM REMOTE BUT LEAVE THOSE WHICH MRs ARE STILL OPEN
git branch --all | \
/bin/grep -v -E "develop|release|master|production|mcc-123-somebranch" | \
cut -d"/" -f3 | \
xargs -n1 git push origin --delete
lsblk #only the one with 'luks' are encrypted
#NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
#nvme0n1 259:0 0 238.5G 0 disk
#├─nvme0n1p3 259:3 0 20G 0 part
#│ └─luks-9e2bd0d0-9006-4b4b-b32e-dfd23a3bcceb
#│ 253:0 0 20G 0 crypt /
#├─nvme0n1p1 259:1 0 256M 0 part /boot/efi
#├─nvme0n1p4 259:4 0 217.2G 0 part
#│ └─luks-cf1d74d5-fed2-43bb-b759-06e9a417c30b
@hoto
hoto / luks-crypt-fedora.sh
Last active January 31, 2017 22:24
luks crypt partition (fedora)
https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption
cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat <device>
cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda3
LIST=`fleetctl list-machines | grep worker | awk '{print $2}'`
for item in $LIST; do echo $item; done
for item in $LIST; do ssh -A core@$item; done
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v release |
grep -v develop |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@hoto
hoto / enjoy
Last active August 29, 2015 14:05
[gist]https://gist.github.com/hoto/9c89e66e2a5848c5a25f[/gist]
@hoto
hoto / literals-on-console.js
Created August 24, 2014 17:16
Logging object literals on console
var literal = {'if' : 'it', 'fits' : 'i', 'sits' : ''};
console.log(literal);
console.log('literal is: ' + literal);
console.log('literal is: ', literal);
@hoto
hoto / for-in-object-literal.js
Last active August 29, 2015 14:04
Iterating over object literals in javascript using for in
var objectLiteral = {
name: 'bilbo',
surname: 'bagins'
};
for(var key in objectLiteral){
if(objectLiteral.hasOwnProperty(key)){
console.log('key: ' + key);
console.log('value: ' + objectLiteral[key]);
}