Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ptantiku on github.
  • I am ptantiku (https://keybase.io/ptantiku) on keybase.
  • I have a public key ASCODTlqSstH-SUanGcawDf0u8AaH1tDQql7OLHtg0hktwo

To claim this, I am signing this object:

@ptantiku
ptantiku / generateBunfig.ts
Last active April 5, 2024 04:46
Generate Bunfig.toml by using scope and token from .npmrc
#!/usr/bin/env bun
import Bun from 'bun';
/**
* Main function
* @return {Promise<void>} nothing
*/
async function main() {
// open and read inFile
@ptantiku
ptantiku / setup-mahidol-vpn-for-ubuntu.md
Last active April 12, 2020 23:42
Setting up Mahidol VPN on Ubuntu

Setting up Mahidol VPN on Ubuntu

  • Mahidol VPN is Juniper Pulse VPN
  • Ubuntu network connection is managed by Network Manager

Normal Steps

sudo apt install openconnect libopenconnect5 network-manager-openconnect network-manager-openconnect-gnome
@ptantiku
ptantiku / setup-python3.8-via-ppa.sh
Last active April 14, 2023 12:31
Setup Python3.8 in Ubuntu Xenial (16.04 LTS). The python version was fixed at Python 3.5.1
#!/bin/sh
# install PPA
sudo add-apt-repository ppa:deadsnakes/ppa
# update and install
sudo apt update
sudo apt install python3.8 python3.8-dev python3.8-venv
# setup alternatives
@ptantiku
ptantiku / .tmux.conf
Created August 28, 2019 06:33
tmux in vim mode
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# vi is good
set-window-option -g mode-keys vi
#!/bin/bash
export project=PROJECT_NAME_HERE
# create project folder
mkdir $project
cd $project
# setup virtual environment
python -m venv .venv

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

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.
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
@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