Skip to content

Instantly share code, notes, and snippets.

[void@stas-console ~]$ cat /tmp/t
foo=bar
boo=baz
zee=roo=zag
# this prints changed file but doesn't write changes to file
[void@stas-console ~]$ sed -e 's/=/="/' -e 's/$/"/g' -e 's/^/export /g' /tmp/t
export foo="bar"
[void@stas-console ~]$ VAR='qwe asd erty dfgh vbn'
[void@stas-console ~]$ echo $(awk -v var="$VAR" 'BEGIN { count=split(var,fields," "); print fields[count-2] }')
erty
sudo apt-get update
sudo apt-get install docker-compose
mkdir ~/youtube-dl
cd ~/youtube-dl
cat >docker-compose.yml<<EOF
version: '3'
services:
youtube-dl:
build:
@flashvoid
flashvoid / gist:2027ff6dc963a8e49955b844bcd5b952
Created August 20, 2019 03:59
openstack tools cluster config
function openstack-cli() {
docker run -it --rm $(env | grep OS_ | sed 's/=.*//;s/^/--env /' | tr '\n' ' ') -v /etc/hosts:/etc/hosts gitlab.int.catalystcloud.nz:4567/catalystcloud/openstack-cli --insecure $@
}
source openrc.sh
openstack-cli coe cluster config stas-test
# поднимаем сервер
# nc -l 9090 &
[1] 13126
# ставим дамп
# tcpdump -i any port 9090 -A &
[2] 13130
# tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
# клиент посылает данные серверу
@flashvoid
flashvoid / data
Last active November 14, 2017 23:51
Take file with column of numbers, in every block of 5 filter out ones larger then token
1
2
3
4
5
6
7
8
12
31
@flashvoid
flashvoid / data
Last active November 13, 2017 00:13
overlay on gce with vxlan unicast flood
{
"c1": {
"hostname": "netlab-1-0xwl",
"interfaces": {
"vx1" : {
"oip": "192.168.1.2/24",
"vid": 1,
"remotes": [
"10.240.0.8"
]
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo mdkir /etc/wicd_sdk^C
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo su
root@ip-192-168-99-10:/home/ubuntu# mkdir /etc/wicd_sdk
root@ip-192-168-99-10:/home/ubuntu# mkdir /etc/wicd_sdk/output
root@ip-192-168-99-10:/home/ubuntu# chown ubuntu:ubuntu /etc/wicd_sdk/output
root@ip-192-168-99-10:/home/ubuntu# exit
(stas-policy)ubuntu@ip-192-168-99-10:~$ touch /etc/wicd_sdk/output/token1
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo chmod 400 /etc/wicd_sdk
(stas-policy)ubuntu@ip-192-168-99-10:~$ touch /etc/wicd_sdk/output/token2
touch: cannot touch '/etc/wicd_sdk/output/token2': Permission denied
server {
listen 443;
server_name localhost;
root html;
index index.html index.htm;
ssl on;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
@flashvoid
flashvoid / gist:0965307f6f63612e363521c46229bbe6
Last active April 7, 2017 05:07
format hex string using awk
#!/bin/sh
awk '{
split($0, chars, "");
for (i=1; i<=length($0); i++) {
if (flagInLine == 0) { printf ("%-5d", i/32); flagInLine=1 }
printf("%s%s ", chars[i], chars[i+1]);
if ((i+1) % 32 == 0) { flagInLine=0; printf "\n"}
i++
}