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 / Bash-lines.txt
Created June 1, 2019 17:37
Install dotnet core in Ubuntu 18.04
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
@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 \
@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

Keybase proof

I hereby claim:

  • I am Ujang360 on github.
  • I am kresna (https://keybase.io/kresna) on keybase.
  • I have a public key ASAz1dUkOaSPx0sIJRGW0eGa9WoGDjh8VCi8nCidvVpPBgo

To claim this, I am signing this object:

@Ujang360
Ujang360 / install-docker.sh
Created July 26, 2019 09:59
Install Docker in Ubuntu 19.04
#!bin/sh
cd ~
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge"
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo usermod -aG docker ${USER}
@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
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 / main.rs
Created October 19, 2019 09:29
Multithreaded Logger Demo (Rust)
use log::info;
use std::env;
use std::sync::mpsc;
use std::sync::mpsc::Sender;
use std::thread;
fn init_log() {
env::set_var("RUST_LOG", "info");
env_logger::builder()
.default_format()
@Ujang360
Ujang360 / start-tmux.py
Created October 19, 2019 13:20
Start TMUX Prompt
#!/usr/bin/python3
import libtmux
import subprocess
import os
def create_new_session(tmux_server: libtmux.Server):
user_answer = input("Input session name: ")
tmux_server.new_session(session_name=user_answer)
@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"