Rewrote the whole website to get rid on a heavy theme

This commit is contained in:
Julien Dessaux 2021-03-11 18:53:14 +01:00
parent 3ea54810ad
commit 60d3abc6ec
122 changed files with 346 additions and 2558 deletions

View file

@ -0,0 +1,5 @@
---
title: "Commands"
linkTitle: "Commands"
weight: 40
---

View file

@ -0,0 +1,11 @@
---
title: "List active calls on asterisk"
linkTitle: "List active calls on asterisk"
date: 2018-09-25
description: >
How to show active calls on an asterisk system
---
{{< highlight yaml >}}
watch -d -n1 'asterisk -rx “core show channels”'
{{< /highlight >}}

View file

@ -0,0 +1,14 @@
---
title: "How to have asterisk call you into a meeting"
linkTitle: "How to have asterisk call you into a meeting"
date: 2018-09-25
description: >
How to have asterisk call you itself into a meeting
---
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

@ -0,0 +1,13 @@
---
title: "Busybox web server"
linkTitle: "Busybox web server"
date: 2019-04-16
description: >
Busybox web server
---
If you have been using things like `python -m SimpleHTTPServer`, here is something even more simple and lightweight to use :
{{< highlight sh >}}
busybox httpd -vfp 80
{{< /highlight >}}

View file

@ -0,0 +1,13 @@
---
title: "Capture a video of your desktop"
linkTitle: "Capture a video of your desktop"
date: 2011-11-20
description: >
Capture a video of your desktop
---
You can capture a video of your linux desktop with ffmpeg :
{{< highlight sh >}}
ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq /tmp/out.mpg
{{< /highlight >}}

View file

@ -0,0 +1,17 @@
---
title: "Clean conntrack states"
linkTitle: "Clean conntrack states"
date: 2018-03-02
description: >
Clean conntrack states
---
Here is an example of how to clean conntrack states that match a specific query on a linux firewall :
{{< highlight 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

@ -0,0 +1,14 @@
---
title: "Convert unix timestamp to readable date"
linkTitle: "Convert unix timestamp to readable date"
date: 2011-01-06
description: >
Convert unix timestamp to readable date
---
As I somehow have a hard time remembering this simple date flags as I rarely need it, I decided to write it down here :
{{< highlight sh >}}
$ date -d @1294319676
Thu Jan 6 13:14:36 GMT 2011
{{< /highlight >}}

View file

@ -0,0 +1,20 @@
---
title: "DMIdecode"
linkTitle: "DMIdecode"
date: 2011-02-16
description: >
DMIdecode
---
DMIdecode to obtain Hardware informations.
## Mose useful commands
- System informations: `dmidecode -t1`
- Chassis informations: `dmidecode -t4`
- CPU informations: `dmidecode -t4`
- RAM informations: `dmidecode -t17`
## Sources
- `man 8 dmidecode`

View file

@ -0,0 +1,12 @@
---
title: "Find hardlinks to a same file"
linkTitle: "Find hardlinks to a same file"
date: 2018-03-02
description: >
Find hardlinks to a same file
---
{{< highlight sh >}}
find . -samefile /path/to/file
{{< /highlight >}}

View file

@ -0,0 +1,12 @@
---
title: "Find where inodes are used"
linkTitle: "Find where inodes are used"
date: 2018-04-25
description: >
Find where inodes are used
---
{{< highlight sh >}}
find . -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
{{< /highlight >}}

View file

@ -0,0 +1,13 @@
---
title: "Import commits from one git repo to another"
linkTitle: "Import commits from one git repo to another"
date: 2018-09-25
description: >
Import commits from one git repo to another
---
This imports commits from a repo in the `../masterfiles` folder and applies them to the repository inside the current folder :
{{< highlight sh >}}
(cd ../masterfiles/; git format-patch stdout origin/master) | git am
{{< /highlight >}}

View file

@ -0,0 +1,13 @@
---
title: "Rewrite a git commit history"
linkTitle: "Rewrite a git commit history"
date: 2018-03-05
description: >
Rewrite a git commit history
---
Here is how to rewrite a git commit history, for example to remove a file :
{{< highlight sh >}}
git filter-branch index-filter "git rm --cached --ignore-unmatch ${file}" --prune-empty --tag-name-filter cat - -all
{{< /highlight >}}

View file

@ -0,0 +1,19 @@
---
title: "ipmitool"
linkTitle: "ipmitool"
date: 2018-03-05
description: >
ipmitool
---
- launch ipmi shell : `ipmitool -H XX.XX.XX.XX -C3 -I lanplus -U <ipmi_user> shell`
- 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 >}}
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

@ -0,0 +1,42 @@
---
title: "mdadm"
linkTitle: "mdadm"
date: 2011-11-15
description: >
mdadm
---
## Watch the array status
{{< highlight sh >}}
watch -d -n10 mdadm --detail /dev/md127
{{< /highlight >}}
## Recovery from livecd
{{< highlight 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 >}}
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
{{< /highlight >}}
## Resync an array
First rigorously check the output of `cat /proc/mdstat`
{{< highlight sh >}}
mdadm --manage --re-add /dev/md0 /dev/sdb1
{{< /highlight >}}
## Destroy an array
{{< highlight sh >}}
mdadm --stop /dev/md0
mdadm --zero-superblock /dev/sda
mdadm --zero-superblock /dev/sdb
{{< /highlight >}}

View file

@ -0,0 +1,11 @@
---
title: "MegaCLI"
linkTitle: "MegaCLI"
date: 2018-03-05
description: >
MegaCLI for dell hardware investigations
---
- `megacli -LDInfo -LALL -aALL|grep state`
- `MegaCli -PDlist -a0|less`

View file

@ -0,0 +1,20 @@
---
title: "omreport"
linkTitle: "omreport"
date: 2018-03-05
description: >
omreport
---
## Your raid status at a glance
- `omreport storage pdisk controller=0 vdisk=0|grep -E '^ID|State|Capacity|Part Number'|grep -B1 -A2 Failed`
## Other commands
{{< highlight sh >}}
omreport storage vdisk
omreport storage pdisk controller=0 vdisk=0
omreport storage pdisk controller=0 pdisk=0:0:4
{{< /highlight >}}

View file

@ -0,0 +1,17 @@
---
title: "qemu-nbd"
linkTitle: "qemu-nbd"
date: 2019-07-01
description: >
qemu-nbd
---
{{< highlight 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

@ -0,0 +1,31 @@
---
title: "Qemu"
linkTitle: "Qemu"
date: 2019-06-10
description: >
Qemu
---
## 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 >}}
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 >}}
qemu-system-x86_64 -curses -drive file=miniroot65.fs -drive file=/dev/sda -net nic -net user
{{< /highlight >}}
## Ressources
- https://github.com/dodoritfort/OpenBSD/wiki/Installer-OpenBSD-sur-votre-serveur-Kimsufi

View file

@ -0,0 +1,21 @@
---
title: "rrdtool"
linkTitle: "rrdtool"
date: 2018-09-25
description: >
rrdtool
---
## Graph manually
{{< highlight 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
- https://calomel.org/rrdtool.html