Skip to content

Instantly share code, notes, and snippets.

View repodevs's full-sized avatar

Edi Santoso repodevs

View GitHub Profile
@repodevs
repodevs / gist:82566dafaf515d32a1832812ac2bd773
Created January 27, 2021 15:20
Linux command to watch bandwidth usage using ifstat
$ ifstat -ntS -i eth0
@repodevs
repodevs / latest-opera-instant-search.txt
Created January 9, 2021 08:32
Latest Opera browser that has Instant Search feature
Download Latest Opera Browser that has Instant Search feature at http://get.opera.com/ftp/pub/opera/desktop/67.0.3575.97/
@repodevs
repodevs / docker-in-docker.md
Last active January 1, 2021 06:47
Run Docker inside Docker Ubuntu Images

Run Docker inside Docker Ubuntu Images

The story begin when I want to install docker inside mltooling/ml-workspace-minimal images, which is based on ubuntu 18. so here how to run docker inside docker ubuntu images

docker run -d --name mltool \ 
  -p 8080:8080 \ 
  -v /root:/workspace \ 
 -v /var/run/docker.sock:/var/run/docker.sock \ 
@repodevs
repodevs / .env
Created December 5, 2020 16:59
python-decouple casting octal number 0o in python3
# by default this is will be converted to string
# if you want cast to octal number you need custom cast function
FILE_UPLOAD_PERMISSIONS=0o644
@repodevs
repodevs / find_and_fix_permission.sh
Created December 5, 2020 16:16
Linux command to find and fix permission file
#!/bin/bash
find -type f -not -perm 644 -exec chmod 644 {} \;
@repodevs
repodevs / prune-node_modules.sh
Created May 27, 2020 05:34
Remove unnecessary files from node_modules
# Install `node-prune` from https://github.com/tj/node-prune
curl -sf https://gobinaries.com/tj/node-prune | sh
# Find all `node_modules` directory
# and prune it.
find . -name "node_modules" -type d -exec node-prune {} \;
@repodevs
repodevs / sequelize-mapToModel-example.js
Created April 27, 2020 05:11
sequelize mapToModel example
/**
* @param {UUID} sourceId An ID to find.
*
* @returns {Object} an single object instance of Sequelize Model.
*/
async function getMyTableData(sourceId) {
const sequelize = await this.hub.api('DbConnector', 'Sequelize');
const mytable = await sequelize
.query(`SELECT *
FROM "my_table_name"
@repodevs
repodevs / django_undo_migration.md
Created February 2, 2020 18:45
How to undo migration in Django

Let say you have migrations like this

project/apps/accounts/migrations
├── 0001_initial.py
├── 0002_historicalprofile_historicaluser.py
├── 0003_auto_20190807_1559.py
├── 0004_auto_20190811_1013.py
@repodevs
repodevs / django_hide_sensitive_in_debug.md
Created October 9, 2019 18:19
Django hide sensitive information when Debug mode

Make sure all sensitive variables use one of the keywords:

API
KEY
PASS
SECRET
SIGNATURE
TOKEN
@repodevs
repodevs / nohup.sh
Created September 8, 2019 12:43
Linux command to run script (program) in background without killed
# when we running script in background using `&` after we logout, the script will be killed,
# to prevent the script being killed we can use `nohup`
$ nohup bash -c "time python myapp.py" > myapp.log 2>&1 &
# this command will run our script in background (even we logout from terminal session)
# and we can still watching the log from `myapp.log`
# e.g `tail -f myapp.log`