Skip to content

Instantly share code, notes, and snippets.

View anvie's full-sized avatar

Robin Syihab anvie

View GitHub Profile
@anvie
anvie / .gitignore
Last active November 29, 2023 07:10
Common .gitignore file
dist/
build/
# Rust
target/
Cargo.lock
*.rs.bk
# Node.js
node_modules/
@anvie
anvie / Dockerfile
Created September 27, 2023 06:26
Base docker image for multiple service in one container settings, contains: cron, python3, and supervisor.
FROM node:bullseye-slim
# Install cron
RUN apt-get update && apt-get install -y cron && which cron && \
rm -rf /etc/cron.*/*
# Install Python3
RUN apt-get install -y python3
# Install Supervisord
@anvie
anvie / nextjs.conf
Created December 22, 2022 15:41
Nginx config for static web build with Nextjs
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ /.+ {
try_files $uri $uri.html $uri =404;
}
@anvie
anvie / FallbackAndSelfDestructExample.sol
Created August 14, 2022 14:52
Fallback and self destruct Solidity example.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract FallbackAndSelfDestructExample is Ownable {
function destroy(address _addr) external onlyOwner {
address payable addr = payable(address(_addr));
@anvie
anvie / mongodb.service
Last active December 21, 2022 05:50
Systemd untuk mongodb
[Unit]
Description=Mongodb Service Container
After=docker.service
Requires=docker.service
[Service]
Type=simple
Restart=always
RestartSec=5
StartLimitBurst=5
@anvie
anvie / key_inserter.py
Last active October 5, 2021 08:31
Nuchain Node Keystore Inserter Tool
#!/usr/bin/env python
#
# Tool digunakan untuk mempermudah insert key ke local keystore Nuchain node melalui CLI.
#
#
import requests as req
import os
import json
@anvie
anvie / nuchain-snapshot.sh
Last active October 7, 2021 08:33
Bash script to snapshot nuchain db use hardlink & 7z
#!/usr/bin/env bash
SRCDIR=$1
DSTDIR=$2
show_usage(){
echo "Usage: nuchain-snapshot [SRCDIR] [DSTDIR]"
echo "Example: nuchain-snapshot /data/nuchain nuchain-snapshot"
}
@anvie
anvie / pre-commit
Last active June 18, 2021 15:29
Git pre-commit script to run code formatter automatically
#!/bin/env bash
set -e
files=$((git diff --cached --name-only --diff-filter=ACMR | grep -Ei "\.rs$") || true)
if [ ! -z "${files}" ]; then
comma_files=$(echo "$files" | paste -s -d "," -)
make fmt
git add $(echo "$files" | paste -s -d " " -)
fi
@anvie
anvie / hela-7.cmd
Created March 28, 2021 11:04
Configuration backup for Hela Drone 7". RTH & Failsafe tested.
# start the command batch
batch start
board_name MAMBAF722
manufacturer_id DIAT
# name: AlapAlap
# resources
resource BEEPER 1 B02
@anvie
anvie / nuchain-container.service
Last active December 21, 2022 05:51
Nuchain Systemd Service Configuration
# Systemd service configuration for Nuchain docker container.
# edit as you wish.
[Unit]
Description=Nuchain Node Container
After=docker.service
Requires=docker.service
[Service]
Type=simple