Refactored syntax highlighting shortcodes into markdown

This commit is contained in:
Julien Dessaux 2023-04-23 22:33:49 +02:00
parent 9e6bb1a3e5
commit ea435049b3
Signed by: adyxax
GPG key ID: F92E51B86E07177E
71 changed files with 297 additions and 297 deletions

View file

@ -8,6 +8,6 @@ tags:
## Using the cli
{{< highlight yaml >}}
```sh
watch -d -n1 'asterisk -rx “core show channels”'
{{< /highlight >}}
```

View file

@ -11,6 +11,6 @@ tags:
At alterway we sometimes have DTMF problems that prevent my mobile from joining a conference room. Here is something I use to have asterisk call me
and place me inside the room :
{{< highlight yaml >}}
```
channel originate SIP/numlog/06XXXXXXXX application MeetMe 85224,M,secret
{{< /highlight >}}
```

View file

@ -11,6 +11,6 @@ tags:
If you have been using things like `python -m SimpleHTTPServer` to serve static files in a pinch, here is something even more simple and lightweight to use :
{{< highlight sh >}}
```sh
busybox httpd -vfp 80
{{< /highlight >}}
```

View file

@ -10,6 +10,6 @@ tags:
You can capture a video of your linux desktop very easily with ffmpeg :
{{< highlight sh >}}
```sh
ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq /tmp/out.mpg
{{< /highlight >}}
```

View file

@ -10,10 +10,10 @@ tags:
Firewalling on linux is messy, here is an example of how to clean conntrack states that match a specific query on a linux firewall :
{{< highlight sh >}}
```sh
conntrack -L conntrack -p tcp orig-dport 65372 | \
while read _ _ _ _ src dst sport dport _; do
conntrack -D conntrack proto tcp orig-src ${src#*=} orig-dst ${dst#*=} \
sport ${sport#*=} dport ${dport#*=}
done
{{< /highlight >}}
```

View file

@ -10,7 +10,7 @@ tags:
I somehow have a hard time remembering this simple date flags *(probably because I rarely get to practice it), I decided to write it down here :
{{< highlight sh >}}
```sh
$ date -d @1294319676
Thu Jan 6 13:14:36 GMT 2011
{{< /highlight >}}
```

View file

@ -10,6 +10,6 @@ tags:
## The command
{{< highlight sh >}}
```sh
find . -samefile /path/to/file
{{< /highlight >}}
```

View file

@ -10,6 +10,6 @@ tags:
## The command
{{< highlight sh >}}
```sh
find . -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
{{< /highlight >}}
```

View file

@ -9,6 +9,6 @@ tags:
## The trick
In an ideal world there should never be a need to do this, but here is how to do it properly if you ever walk into this bizarre problem. This command imports commits from a repo in the `../masterfiles` folder and applies them to the repository inside the current folder :
{{< highlight sh >}}
```sh
(cd ../masterfiles/; git format-patch stdout origin/master) | git am
{{< /highlight >}}
```

View file

@ -9,6 +9,6 @@ tags:
## git filter-branch
Here is how to rewrite a git commit history, for example to remove a file :
{{< highlight sh >}}
```sh
git filter-branch index-filter "git rm --cached --ignore-unmatch ${file}" --prune-empty --tag-name-filter cat - -all
{{< /highlight >}}
```

View file

@ -11,9 +11,9 @@ tags:
- launch ipmi remote text console : `ipmitool -H XX.XX.XX.XX -C3 -I lanplus -U <ipmi_user> sol activate`
- Show local ipmi lan configuration : `ipmitool lan print`
- Update local ipmi lan configuration :
{{< highlight sh >}}
```sh
ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 10.31.149.39
ipmitool lan set 1 netmask 255.255.255.0
mc reset cold
{{< /highlight >}}
```

View file

@ -9,34 +9,34 @@ tags:
## Watch the array status
{{< highlight sh >}}
```sh
watch -d -n10 mdadm --detail /dev/md127
{{< /highlight >}}
```
## Recovery from livecd
{{< highlight sh >}}
```sh
mdadm --examine --scan >> /etc/mdadm.conf
mdadm --assemble --scan /dev/md/root
mount /dev/md127 /mnt # or vgscan...
{{< /highlight >}}
```
If auto detection does not work, you can still assemble an array manually :
{{< highlight sh >}}
```sh
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
{{< /highlight >}}
```
## Resync an array
First rigorously check the output of `cat /proc/mdstat`
{{< highlight sh >}}
```sh
mdadm --manage --re-add /dev/md0 /dev/sdb1
{{< /highlight >}}
```
## Destroy an array
{{< highlight sh >}}
```sh
mdadm --stop /dev/md0
mdadm --zero-superblock /dev/sda
mdadm --zero-superblock /dev/sdb
{{< /highlight >}}
```

View file

@ -12,8 +12,8 @@ tags:
## Other commands
{{< highlight sh >}}
```sh
omreport storage vdisk
omreport storage pdisk controller=0 vdisk=0
omreport storage pdisk controller=0 pdisk=0:0:4
{{< /highlight >}}
```

View file

@ -9,11 +9,11 @@ tags:
## Usage example
{{< highlight sh >}}
```sh
modprobe nbd max_part=8
qemu-nbd -c /dev/nbd0 image.img
mount /dev/nbd0p1 /mnt # or vgscan && vgchange -ay
[...]
umount /mnt
qemu-nbd -d /dev/nbd0
{{< /highlight >}}
```

View file

@ -10,23 +10,23 @@ tags:
## Quickly launch a qemu vm with local qcow as hard drive
In this example I am using the docker0 bridge because I do not want to have to modify my shorewall config, but any proper bridge would do :
{{< highlight sh >}}
```sh
ip tuntap add tap0 mode tap
brctl addif docker0 tap0
qemu-img create -f qcow2 obsd.qcow2 10G
qemu-system-x86_64 -curses -drive file=install65.fs,format=raw -drive file=obsd.qcow2 \
-net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0
qemu-system-x86_64 -curses -drive file=obsd.qcow2 -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0
{{< /highlight >}}
```
The first qemu command runs the installer, the second one just runs the vm.
## Launch a qemu vm with your local hard drive
My use case for this is to install openbsd on a server from a hosting provider that doesn't provide an openbsd installer :
{{< highlight sh >}}
```sh
qemu-system-x86_64 -curses -drive file=miniroot65.fs -drive file=/dev/sda -net nic -net user
{{< /highlight >}}
```
## Ressources

View file

@ -8,13 +8,13 @@ tags:
## Graph manually
{{< highlight sh >}}
```sh
for i in `ls`; do
rrdtool graph $i.png -w 1024 -h 768 -a PNG --slope-mode --font DEFAULT:7: \
--start -3days --end now DEF:in=$i:netin:MAX DEF:out=$i:netout:MAX \
LINE1:in#0000FF:"in" LINE1:out#00FF00:"out"
done
{{< /highlight >}}
```
## References