Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Install Java Runtime + Compiler (optional),
# other options: package "default-jdk" will get openjdk-11
sudo apt install openjdk-8-jdk
# install Jenkins
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
echo "deb https://pkg.jenkins.io/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list
sudo apt update
icacls "%HOMEPATH%\Dropbox" /grant "%USERNAME%":(F) /T
@ptantiku
ptantiku / express_https.js
Created April 30, 2018 17:30
Append code to app.js for enable HTTP or HTTPS
// start the server HTTP & HTTPS
const http = require('http');
const https = require('https');
const fs = require('fs');
var credentials = {
key: fs.readFileSync('./ssl-cert.key'),
cert: fs.readFileSync('./ssl-cert.cert')
};
@ptantiku
ptantiku / https_proxy.js
Created April 30, 2018 17:26
Create HTTPS proxy on port 3443 to proxy to port 3000
const fs = require('fs');
const httpProxy = require('http-proxy');
httpProxy.createServer({
target: {
host: 'localhost',
port: 3000
},
ssl: {
key: fs.readFileSync('./server.key'),
cert: fs.readFileSync('./server.crt')
@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
# 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 / Dell_PowerEdge_Clear_SEL.md
Created December 6, 2017 17:37
Clear event log on Dell PowerEdge server

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

#!/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