Skip to content

Instantly share code, notes, and snippets.

@ptantiku
ptantiku / fix_openconnect.md
Created August 30, 2017 18:33
Fix openconnect for when connecting to juniper web login, it cannot parse '<input type="username"' as a username field
@ptantiku
ptantiku / setup_ledger.sh
Last active October 21, 2023 08:35
Setup Ledger Nano S in Linux, with fixing problem on Fedora
#!/bin/bash
# Setup Ledger Nano S in Linux
# according to http://support.ledgerwallet.com/knowledge_base/topics/ledger-wallet-is-not-recognized-on-linux
# However, in Fedora, the "plugdev" group is not existed (obsolete).
# The solution is to replace `GROUP=\"plugdev\"` to `OWNER=\"<username>\"` in the script, for example:
# Original rule: SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev"
# Change to: SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001", MODE="0660", OWNER="ptantiku"
wget -q -O - https://www.ledgerwallet.com/support/add_udev_rules.sh | sed -re 's/GROUP=\\"plugdev\\"/OWNER=\\"'$(whoami)'\\"/' | sudo bash
@ptantiku
ptantiku / disable_cloud-init_cirros.md
Created October 10, 2017 16:38
disable cloud-init from CirrOS

Disable cloud-init from CirrOS

Problem: when cirros boot, it takes too long to reach the login prompt, because it starts process of cloud-init.

  1. Download cirros from CirrOS 0.3.5
  2. convert .img file (qcow2 format) to .vdi or .vmdk format, using command:
    qemu-image convert -f qcow2 -O vmdk cirros_0.3.5_i386.img cirros_0.3.5_i386.vmdk
  3. Create a new vm in virtualbox/vmware with the .vdi/.vmdk as its harddisk.

OWASP Projects

  • Benchmark
  • my project
  • MyPyApacheFW
  • O-Saft
  • OWASP .NET Project
  • OWASP Academy Portal Project
  • OWASP Androïck Project
  • OWASP Anti-Ransomware Guide Project
#!/bin/bash
# an answer from https://superuser.com/questions/692990/use-ffmpeg-copy-codec-to-combine-ts-files-into-a-single-mp4
for i in `ls *.ts | sort -V`; do echo "file $i"; done >> mylist.txt
ffmpeg -f concat -i mylist.txt -c copy -bsf:a aac_adtstoasc video.mp4

Create Boot CD for Openstack

Why?

I got stuck when trying to extend the root partition. The partition table ended up broken and I cannot boot into the system.

Preparation

  • download Hiren Boot CD, it will come in .iso format
  • install syslinux in the system (sudo yum install -y syslinux)

Make the CD image with partition table

@ptantiku
ptantiku / Dell_PowerEdge_Clear_SEL.md
Created December 6, 2017 17:37
Clear event log on Dell PowerEdge server
# date: 2017-12-30
# continuing from https://gist.github.com/whizzzkid/37c0d365f1c7aa555885d102ec61c048
# today, Ubuntu pushed a new update for Nvidia, and it crashed my machine.
# if blinking uncontrollably, it is because gdm is crashed and trying to restart
# use Ctrl+Alt+F2 (multiple times) trying to switch to second console, and login
sudo systemctl stop gdm # stop gdm service, thus stop the blinking
# go to bumblebee config
sudo vi /etc/bumblebee/bumblebee.conf
@ptantiku
ptantiku / add_ledger_udev.sh
Last active March 29, 2018 17:03
Adding udev for Ledger Nano S (must run with "sudo")
#!/bin/bash
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"1b7c\", MODE=\"0660\", GROUP=\"plugdev\"" > /etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"2b7c\", MODE=\"0660\", GROUP=\"plugdev\"" >>/etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"3b7c\", MODE=\"0660\", GROUP=\"plugdev\"" >>/etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"4b7c\", MODE=\"0660\", GROUP=\"plugdev\"" >>/etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"1807\", MODE=\"0660\", GROUP=\"plugdev\"" >>/etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2581\", ATTRS{idProduct}==\"1808\", MODE=\"0660\", GROUP=\"plugdev\"" >>/etc/udev/rules.d/20-ledger.rules
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"2c97\", ATTRS{idProduct}==\"0000\", MODE=\"0660\", GRO