Skip to content

Instantly share code, notes, and snippets.

@tegarimansyah
tegarimansyah / install-virtualenvwrapper.sh
Last active December 11, 2020 22:58
Install Virtual Env Wrapper with python3 on ubuntu with zsh
set -ex
sudo apt install python3-pip
sudo pip install virtualenv virtualenvwrapper
mkdir ~/.virtualenvs
export shell_resource_file='~/.zshrc'
cat <<EOT >> ~/.zshrc # it should $shell_resource_file
echo export WORKON_HOME=~/.virtualenvs
{
"hello":"world",
"number": [
1,2,3,4,5,6,7
]
}
@tegarimansyah
tegarimansyah / install-nginx.sh
Last active December 4, 2022 22:50
Set Up Nginx, UFW, etc for Ubuntu Linux 18.04 or newer
# NGINX UFW Cheatsheet
# Nginx Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
# Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic)
# Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)
sudo apt update
sudo apt install nginx ufw -y
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'OpenSSH' # Just in case ssh not allowed
@tegarimansyah
tegarimansyah / tick-compose.yml
Created April 16, 2020 02:26
Docker Compose for Tick Stack
version: '3'
services:
influxdb:
image: 'influxdb:latest'
container_name: influxDB
networks:
- tick-network
volumes:
- './tick-stack/influxdb/data:/var/lib/influxdb'
- './tick-stack/influxdb/config/:/etc/influxdb/'
@tegarimansyah
tegarimansyah / install-docker.sh
Last active January 1, 2023 14:13
Set Up Docker for Ubuntu Linux 18.04 or newer
set -ex
# Preparation
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
source /etc/lsb-release # Get current version codename
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $DISTRIB_CODENAME stable"
sudo apt update
@tegarimansyah
tegarimansyah / OLX.xml
Last active September 26, 2019 06:17
Sample of Open edX OLX for programming
<problem>
<coderesponse queuename="test-pull">
<html>
<style>
p.label {
margin-bottom: 0 !important;
}
.sample-input-output {
display: block;
padding: 5px;
@tegarimansyah
tegarimansyah / app.py
Created April 17, 2019 13:41
Belajar Flask + SQLAlchemy
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
# http://flask-sqlalchemy.pocoo.org/2.3/quickstart/#a-minimal-application
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://my_user:my_password@127.0.0.1/my_database'
db = SQLAlchemy(app)
@tegarimansyah
tegarimansyah / docker_laravel.sh
Last active November 13, 2018 01:09
Dockerizing Apps
docker run --rm -v $(pwd):/app composer/composer install
# Error:
# Loading composer repositories with package information
# Installing dependencies (including require-dev) from lock file
# Your requirements could not be resolved to an installable set of packages.
# Problem 1
# - Installation request for symfony/event-dispatcher v3.4.17 -> satisfiable by symfony/event-dispatcher[v3.4.17].
# - symfony/event-dispatcher v3.4.17 requires php ^5.5.9|>=7.0.8 -> your PHP version (7.0.7) does not satisfy that requirement.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tegarimansyah
tegarimansyah / pandas_with_internet.ipynb
Last active November 2, 2018 09:33
Pandas with Internet Data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.