aboutsummaryrefslogtreecommitdiff
path: root/content/blog/commands
diff options
context:
space:
mode:
authorJulien Dessaux2021-03-11 18:53:14 +0100
committerJulien Dessaux2021-03-11 18:53:14 +0100
commit60d3abc6ecdc21b4ab921d34a55b4af48690f55a (patch)
tree1ee530dd7367d743fb619f341100e41df22e1985 /content/blog/commands
parentUpdated docsy theme (diff)
downloadwww-60d3abc6ecdc21b4ab921d34a55b4af48690f55a.tar.gz
www-60d3abc6ecdc21b4ab921d34a55b4af48690f55a.tar.bz2
www-60d3abc6ecdc21b4ab921d34a55b4af48690f55a.zip
Rewrote the whole website to get rid on a heavy theme
Diffstat (limited to 'content/blog/commands')
-rw-r--r--content/blog/commands/_index.md5
-rw-r--r--content/blog/commands/asterisk-call-you.md11
-rw-r--r--content/blog/commands/asterisk-list-active-calls.md14
-rw-r--r--content/blog/commands/busybox-web-server.md13
-rw-r--r--content/blog/commands/capture-desktop-video.md13
-rw-r--r--content/blog/commands/clean-conntrack-states.md17
-rw-r--r--content/blog/commands/date.md14
-rw-r--r--content/blog/commands/dmidecode.md20
-rw-r--r--content/blog/commands/find-hardlinks.md12
-rw-r--r--content/blog/commands/find-inodes-used.md12
-rw-r--r--content/blog/commands/git-import-commits.md13
-rw-r--r--content/blog/commands/git-rewrite-commit-history.md13
-rw-r--r--content/blog/commands/ipmi.md19
-rw-r--r--content/blog/commands/mdadm.md42
-rw-r--r--content/blog/commands/megacli.md11
-rw-r--r--content/blog/commands/omreport.md20
-rw-r--r--content/blog/commands/qemu-nbd.md17
-rw-r--r--content/blog/commands/qemu.md31
-rw-r--r--content/blog/commands/rrdtool.md21
19 files changed, 318 insertions, 0 deletions
diff --git a/content/blog/commands/_index.md b/content/blog/commands/_index.md
new file mode 100644
index 0000000..c061e46
--- /dev/null
+++ b/content/blog/commands/_index.md
@@ -0,0 +1,5 @@
+---
+title: "Commands"
+linkTitle: "Commands"
+weight: 40
+---
diff --git a/content/blog/commands/asterisk-call-you.md b/content/blog/commands/asterisk-call-you.md
new file mode 100644
index 0000000..7dd65f3
--- /dev/null
+++ b/content/blog/commands/asterisk-call-you.md
@@ -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 >}}
diff --git a/content/blog/commands/asterisk-list-active-calls.md b/content/blog/commands/asterisk-list-active-calls.md
new file mode 100644
index 0000000..73c712e
--- /dev/null
+++ b/content/blog/commands/asterisk-list-active-calls.md
@@ -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 >}}
diff --git a/content/blog/commands/busybox-web-server.md b/content/blog/commands/busybox-web-server.md
new file mode 100644
index 0000000..37f9ac6
--- /dev/null
+++ b/content/blog/commands/busybox-web-server.md
@@ -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 >}}
diff --git a/content/blog/commands/capture-desktop-video.md b/content/blog/commands/capture-desktop-video.md
new file mode 100644
index 0000000..f56572a
--- /dev/null
+++ b/content/blog/commands/capture-desktop-video.md
@@ -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 >}}
diff --git a/content/blog/commands/clean-conntrack-states.md b/content/blog/commands/clean-conntrack-states.md
new file mode 100644
index 0000000..8a78930
--- /dev/null
+++ b/content/blog/commands/clean-conntrack-states.md
@@ -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 >}}
diff --git a/content/blog/commands/date.md b/content/blog/commands/date.md
new file mode 100644
index 0000000..e0b2bcc
--- /dev/null
+++ b/content/blog/commands/date.md
@@ -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 >}}
diff --git a/content/blog/commands/dmidecode.md b/content/blog/commands/dmidecode.md
new file mode 100644
index 0000000..c7bcc1f
--- /dev/null
+++ b/content/blog/commands/dmidecode.md
@@ -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`
diff --git a/content/blog/commands/find-hardlinks.md b/content/blog/commands/find-hardlinks.md
new file mode 100644
index 0000000..dd1b424
--- /dev/null
+++ b/content/blog/commands/find-hardlinks.md
@@ -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 >}}
+
diff --git a/content/blog/commands/find-inodes-used.md b/content/blog/commands/find-inodes-used.md
new file mode 100644
index 0000000..d9965a4
--- /dev/null
+++ b/content/blog/commands/find-inodes-used.md
@@ -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 >}}
+
diff --git a/content/blog/commands/git-import-commits.md b/content/blog/commands/git-import-commits.md
new file mode 100644
index 0000000..5ec2bc1
--- /dev/null
+++ b/content/blog/commands/git-import-commits.md
@@ -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 >}}
+
diff --git a/content/blog/commands/git-rewrite-commit-history.md b/content/blog/commands/git-rewrite-commit-history.md
new file mode 100644
index 0000000..6d241ed
--- /dev/null
+++ b/content/blog/commands/git-rewrite-commit-history.md
@@ -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 >}}
+
diff --git a/content/blog/commands/ipmi.md b/content/blog/commands/ipmi.md
new file mode 100644
index 0000000..93ca26d
--- /dev/null
+++ b/content/blog/commands/ipmi.md
@@ -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 >}}
+
diff --git a/content/blog/commands/mdadm.md b/content/blog/commands/mdadm.md
new file mode 100644
index 0000000..1dbc3f8
--- /dev/null
+++ b/content/blog/commands/mdadm.md
@@ -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 >}}
+
diff --git a/content/blog/commands/megacli.md b/content/blog/commands/megacli.md
new file mode 100644
index 0000000..8eb32a8
--- /dev/null
+++ b/content/blog/commands/megacli.md
@@ -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`
+
diff --git a/content/blog/commands/omreport.md b/content/blog/commands/omreport.md
new file mode 100644
index 0000000..b3d0ffd
--- /dev/null
+++ b/content/blog/commands/omreport.md
@@ -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 >}}
+
diff --git a/content/blog/commands/qemu-nbd.md b/content/blog/commands/qemu-nbd.md
new file mode 100644
index 0000000..ea09658
--- /dev/null
+++ b/content/blog/commands/qemu-nbd.md
@@ -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 >}}
+
diff --git a/content/blog/commands/qemu.md b/content/blog/commands/qemu.md
new file mode 100644
index 0000000..b3beb2c
--- /dev/null
+++ b/content/blog/commands/qemu.md
@@ -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
diff --git a/content/blog/commands/rrdtool.md b/content/blog/commands/rrdtool.md
new file mode 100644
index 0000000..33f54dc
--- /dev/null
+++ b/content/blog/commands/rrdtool.md
@@ -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