Skip to content

Instantly share code, notes, and snippets.

@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 / 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')
};
icacls "%HOMEPATH%\Dropbox" /grant "%USERNAME%":(F) /T
#!/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
@ptantiku
ptantiku / compile_porosity.sh
Created May 21, 2018 12:10
Porosity compilation steps.
# install dependencies
sudo apt install libboost-all-dev build-essential
# download source code
git clone https://github.com/comaeio/porosity.git
cd porosity/porosity/porosity/
# this is workaround file for fixing bug in libboost1.58-dev
wget https://raw.githubusercontent.com/ethereum/solidity/develop/libdevcore/boost_multiprecision_number_compare_bug_workaround.hpp
sudo apt install vim
cat > ~/.vimrc <<END
inoremap jk <esc>
inoremap kj <esc>
nnoremap H 0
nnoremap L $
set et ts=2 sw=2 sts=2 modeline number hlsearch
END
# set bash to vim-mode

Extracting APK file from an android device

ref: https://geekeasier.com/extract-apk-file-of-android-app-without-root/4769/

  1. adb devices, this is to check whether your devices is connected or not
  2. adb shell pm list packages, this lists down all the packages name. Select whatever package name you want to extract.
  3. adb shell pm path package-name, selects the package you want to extract, this will give you the full path of the package, copy it down in the next step.
  4. adb pull /data/app/package-path desired/path, extracts the package to the desired specified location.

Resizing Openstack VM's Volumes

Problem:

  1. to resize the volume, the volume must be detached first.
  2. but if it is the only boot volume, or the vm is created by the volume, it cannot be detached.

Solution (after shutdown the VM):

  1. Login . ~/keystone_admin
  2. Check volume ID, VM ID by cinder list or openstack volume list, for ex.

VOLUME=ce6e79c1-5b57-49aa-9a66-acf17f37be70

#!/bin/bash
export project=PROJECT_NAME_HERE
# create project folder
mkdir $project
cd $project
# setup virtual environment
python -m venv .venv