Skip to content

Instantly share code, notes, and snippets.

View Ujang360's full-sized avatar
🏠
Working from Home

Aditya Kresna Ujang360

🏠
Working from Home
View GitHub Profile
@Ujang360
Ujang360 / Dockerfile
Created December 5, 2019 02:41 — forked from yogeek/Dockerfile
Gosu usage in Docker
FROM ubuntu
RUN apt-get install ...
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.10
RUN set -x \
&& curl -sSLo /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& curl -sSLo /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
@Ujang360
Ujang360 / matching_engine.cpp
Created October 19, 2019 16:16 — forked from dendisuhubdy/matching_engine.cpp
Ivan's Matching Engine
/*!
\file matching_engine.cpp
\brief Matching engine example
\author Ivan Shynkarenka
\date 16.08.2017
\copyright MIT License
*/
#include "trader/matching/market_manager.h"
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
@Ujang360
Ujang360 / sshpub-to-rsa
Created July 30, 2019 03:11 — forked from thwarted/sshpub-to-rsa
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@Ujang360
Ujang360 / .vimrc
Created July 19, 2019 01:43 — forked from dendisuhubdy/.vimrc
VIMRC
" Fisa-vim-config
" http://fisadev.github.io/fisa-vim-config/
" version: 8.3.1
" ============================================================================
" Vim-plug initialization
" Avoid modify this section, unless you are very sure of what you are doing
" Vim Tab as 4 Spaces
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
@Ujang360
Ujang360 / cc-alternatives.sh
Last active January 14, 2021 09:53 — forked from bhaskarvk/Setup GCC and CLANG Toolchains.md
Proper GCC (vers. 5/6/7/8) & LLVM/CLANG (vers. 4/5/6/7/8) Toolchain Setup on Ubuntu 18.04
#!/usr/bin/env sh
# Remove all existing alternatives
sudo update-alternatives --remove-all cc
# exit on first error
set -e
sudo update-alternatives \
--install /usr/bin/cc cc /usr/bin/gcc 30 \