Skip to content

Instantly share code, notes, and snippets.

View rririanto's full-sized avatar
🏠
Working from home

Rahmat Ramadhan rririanto

🏠
Working from home
View GitHub Profile
@rririanto
rririanto / jq_large_remove.sh
Last active March 27, 2022 14:43
Using Jq on large json file (10GB), remove one key from json large file
jq -n --stream 'fromstream(inputs|select((length == 2 and .[0][1] == "_id")|not))' users_large.json > users.json
@rririanto
rririanto / Mongoimport.sh
Created March 26, 2022 18:38
Mongoimport with clean _id
mongoimport --collection users --file users.json --jsonArray --uri $MONGO_URI_NEW
mongoimport --collection products --file products.json --jsonArray --uri $MONGO_URI_NEW
@rririanto
rririanto / Mongoexport.sh
Last active March 26, 2022 18:35
Remove _id from Mongoexport result
export MONGODB_URI="mongodb://<username>:<password>@<ip:port>/<database>?authMechanism=SCRAM-SHA-256&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false"
mongoexport --collection=users --out=users_raw.json --jsonArray --uri=$MONGODB_URI && jq 'map(del(._id))' users_raw.json > users.json
mongoexport --collection=products --out=products_raw.json --jsonArray --uri=$MONGODB_URI && jq 'map(del(._id))' products_raw.json > products.json
@rririanto
rririanto / install-python.sh
Created March 13, 2022 19:41
Install python3 DO
sudo apt update
sudo apt install -y python3-pip
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
pip3 install pipenv
ssh-keygen
@rririanto
rririanto / test_user_models.py
Last active May 24, 2021 06:45
Pytest for user models
import pytest
import copy
from apps.user.models import User
from django.forms.models import model_to_dict
from typing import Any, Dict
pytestmark = pytest.mark.django_db
TEST_USERS = {
# pull official python alpine image
FROM python:3.7
# Set Environment Variable
ENV PYTHONUNBUFFERED 1
ENV C_FORCE_ROOT true
RUN mkdir -p /opt/django/dev
# Creating Work Directory
db:
image: postgres
container_name: db
restart: unless-stopped
tty: true
environment:
- POSTGRES_DB=blog
- POSTGRES_USER=blog
- POSTGRES_PASSWORD=blog
ports:
codesign -f -s - /Applications/Discord.app/Contents/Frameworks/Discord\ Helper\ \(Renderer\).app
@rririanto
rririanto / image_to_s3_ghostcms.py
Last active April 29, 2021 01:01
Image to s3 ghost python
import requests # pip install requests
import jwt # pip install pyjwt
from datetime import datetime as date
import json
import os
CONTENT_API = "<YOUR CONTENT API>"
ADMIN_API = "<YOUR ADMIN API>"
API_URL = "<URL ENDPOINT>"
@rririanto
rririanto / country_date_formats.csv
Created April 27, 2021 09:39 — forked from mlconnor/country_date_formats.csv
Listing of countries with their preferred date formats, ISO3166 code, ISO629-2
ISO 3166 Country Code ISO639-2 Country Code Country ISO 3166 Country Code ISO639-2 Lang Language Date Format
ALB AL Albania sqi sq Albanian yyyy-MM-dd
ARE AE United Arab Emirates ara ar Arabic dd/MM/yyyy
ARG AR Argentina spa es Spanish dd/MM/yyyy
AUS AU Australia eng en English d/MM/yyyy
AUT AT Austria deu de German dd.MM.yyyy
BEL BE Belgium fra fr French d/MM/yyyy
BEL BE Belgium nld nl Dutch d/MM/yyyy
BGR BG Bulgaria bul bg Bulgarian yyyy-M-d
BHR BH Bahrain ara ar Arabic dd/MM/yyyy