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
aws iam list-roles --profile sandbox --query "Roles[?RoleName == 'ABC']"
# Setup IPs for two laptops
PC1 (master0
IP - 192.168.1.2
mask 255.255.255.0
gw - 192.168.1.2
PC2 (slave - live cd)
IP - 192.168.1.3
mask 255.255.255.0
gw - 192.168.1.3
# cgdisk is graphical
sudo cgdisk /dev/sda
sgdisk -o /dev/sda
sgdisk -n 1::+256MiB -u 1:fbf5660e-0474-4361-8b8f-22d8049e6920 -t 1:EF00 /dev/sda
sgdisk -n 2::+1024MiB -u 2:05ee6a32-f7ca-4379-9ac9-80cf6c63933b -t 2:8300 /dev/sda
sgdisk -n 3::+20480MiB -u 3:c522f8fe-01ee-433d-8642-e0c897e817aa -t 3:8304 /dev/sda
sgdisk -n 4::-9MiB -u 4:a086c08d-49f8-48ba-918d-e38d912d734b -t 3:BF01 /dev/sda
sgdisk -n 9::+8MiB -u 9:c3935f60-0315-427c-ac5b-db1808a72112 -t 3:BF07 /dev/sda
dd if=/dev/urandom of=/dev/sda3 bs=1MiB count=10
find . -name '.gitlab-ci.yml' | ack -x -A 4 dependencies
# prepares pendirve so i can install bootable os iso on it
umount
umount /dev/sdb1
dd if=/dev/zero of=/dev/sdb bs=1M count=10
cgdisk /dev/sdb
for folder in $(ls); \
do CURRENT=$(ls ./$folder/) && echo CURRENT=$CURRENT && cp /avatars/blue/$folder.png ./$folder/$CURRENT; done
for name in $(seq 1 1000); \
do echo name=$name && wget --quiet -O $name.svg "http://tinygraphs.com/isogrids/$name?theme=seascape&numcolors=4&size=240&fmt=svg" & done
for name in $(seq 1 1000); \
do echo name=$name && inkscape -z -e $name.png -w 240 -h 240 $name.svg; done
@hoto
hoto / systemd-prblm.service
Created June 27, 2017 14:38 — forked from nickjacob/systemd-prblm.service
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/ech "2 + 2 = ${MYVAR}"
@hoto
hoto / docker-stats.sh
Created June 22, 2017 12:17
docker stats (cpu, memory) with container names
docker stats $(docker ps --format '{{.Names}}')
@hoto
hoto / add-forward-agent-to-ssh-config.sh
Created June 13, 2017 09:48
add forward agent to ssh config
for ip in $(fleetctl list-machines | cut -f 2); \
do \
ssh core@$ip \
bash -c "\
hostname && \
echo -e 'Host * \n ForwardAgent yes\n StrictHostKeyChecking no' > ~/.ssh/config && \
cat ~/.ssh/config"; \
done
@hoto
hoto / copy-file-remotely.sh
Created June 11, 2017 16:26
copy text file to remote server over ssh
cat file.txt | ssh develop "cat >> /tmp/file.txt"