Skip to content

Instantly share code, notes, and snippets.

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

Andrzej Rehmann hoto

:octocat:
‏‏‎ Eating github stars for breakfast.
Block or report user

Report or block hoto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hoto
hoto / for-in-object-literal.js
Last active Aug 29, 2015
Iterating over object literals in javascript using for in
View for-in-object-literal.js
var objectLiteral = {
name: 'bilbo',
surname: 'bagins'
};
for(var key in objectLiteral){
if(objectLiteral.hasOwnProperty(key)){
console.log('key: ' + key);
console.log('value: ' + objectLiteral[key]);
}
View enjoy
[gist]https://gist.github.com/hoto/9c89e66e2a5848c5a25f[/gist]
@hoto
hoto / literals-on-console.js
Created Aug 24, 2014
Logging object literals on console
View literals-on-console.js
var literal = {'if' : 'it', 'fits' : 'i', 'sits' : ''};
console.log(literal);
console.log('literal is: ' + literal);
console.log('literal is: ', literal);
View remove-merged-branches.sh
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 / luks-crypt-fedora.sh
Last active Jan 31, 2017
luks crypt partition (fedora)
View luks-crypt-fedora.sh
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
View crypto-change-password.sh
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
View remove-remote-git-branches.sh
# 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
View command-jumping-to-servers.sh
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
@hoto
hoto / memory.sh
Created May 30, 2017
show memory on all coreos hosts
View memory.sh
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|\$"
@hoto
hoto / ansible_append_line.yml
Created Jun 7, 2017
append line in file using ansible
View ansible_append_line.yml
- name: kernel and python-chardet updates are disabled
replace:
path: /etc/dnf/dnf.conf
regexp: '(\s+exclude=.*)$'
replace: '\1 kernel* python-chardet'
become: yes
You can’t perform that action at this time.