Skip to content

Instantly share code, notes, and snippets.

View TEGRAXD's full-sized avatar
💤
Turu

Tegar Bangun Suganda TEGRAXD

💤
Turu
View GitHub Profile
@TEGRAXD
TEGRAXD / portainer-docker-compose.yaml
Created January 8, 2025 15:20
Portainer Docker Compose with External Network
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
ports:
- "9000:9000" # Any ports of the service that you want to expose.
networks:
- cloudflared_tunnel # The name of cloudflared tunnel docker network.
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@TEGRAXD
TEGRAXD / cloudflared-docker-compose.yaml
Created January 8, 2025 14:58
Cloudflared Docker Compose with Networks
services:
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
command: tunnel --no-autoupdate run --token yourSecretToken
networks:
- tunnel # Use "tunnel" network that we created.
restart: unless-stopped
networks:
@TEGRAXD
TEGRAXD / userSchema.js
Created September 15, 2023 03:55 — forked from jzellis/userSchema.js
Boilerplate for simple Mongoose user schema
/*
I find myself recreating user models for Mongoose every time I start a new project, so I thought I'd create a generic schema for a user model that can be added to or modified as need be.
This is loosely based on the Meteor user model (using a "profile" sub-object for the user's personal information). It also includes an optional geolocation point for the user, and Mongoose timestamps, as well as a pre("save") function to bcrypt the user password and a comparePassword() function.
Just save this file wherever you store your models and do something like const Users = include('./models/userSchema.js') and you can just use it as a standard Mongoose user model.
The username/email address definitions were copied from this tutorial: https://thinkster.io/tutorials/node-json-api/creating-the-user-model
@TEGRAXD
TEGRAXD / music_bot_example.py
Created December 19, 2022 19:19 — forked from Lenart12/music_bot_example.py
A simple music bot written using discord.py rewrite and youtube_dl.
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019 Valentin B.
A simple music bot written in discord.py using youtube-dl.
Though it's a simple example, music bots are complex and require much time and knowledge until they work perfectly.
Use this as an example or a base for your own bot and extend it as you want. If there are any bugs, please let me know.
Requirements:
Python 3.5+
pip install -U discord.py pynacl youtube-dl
@TEGRAXD
TEGRAXD / ConvertNewSteamID.markdown
Created December 4, 2022 16:20 — forked from bcahue/ConvertNewSteamID.markdown
Converting New SteamID Formats in Python

Seeing how SteamIDs have changed recently, I thought I'd write a Gist to help others (including myself!) decypher how to convert these from one format to the other in Python. First, let's go over basics to convert a 64bit CommunityID into a SteamID:

steamid64ident = 76561197960265728

def commid_to_steamid(commid):
  steamid = []
  steamid.append('STEAM_0:')
  steamidacct = int(commid) - steamid64ident
  
import 'package:flutter/widgets.dart';
class PreloadingImageBuilder extends StatefulWidget {
final ImageProvider imageProvider;
final AsyncWidgetBuilder<dynamic> builder;
PreloadingImageBuilder({this.imageProvider, this.builder});
@override
_PreloadingImageBuilderState createState() => _PreloadingImageBuilderState();
@TEGRAXD
TEGRAXD / emulator-install-using-avdmanager.md
Created December 20, 2021 01:25 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@TEGRAXD
TEGRAXD / FriendsTask.py
Created June 11, 2021 08:37
Friend's Task
# read row 4
with open("C:\\test.txt", 'r') as f:
print(f.readlines()[3], end='')
# change line
with open("C:\\test.txt", 'r+') as f:
line = int(input('Line ke berapa yang ingin diganti: '))
# readlines() tidak dapat dipanggil berkali-kali, jadi perlu dipindahkan sementara, jadi kalau mau copy tinggal variable = temporary.
temporary = f.readlines()
@TEGRAXD
TEGRAXD / PentaExample.kt
Created March 6, 2021 17:56
Pair And Title - Penta Kotlin Custom Class Usage Example
fun createExamplePenta() : Penta<Int, String, List<String>, Float, Double> {
return Penta(1, "String Value", listOf("List Value"), 1F, 1.0)
}
val (firstValue, secondValue, thirdValue, fourthValue, fifthValue) = createExamplePenta()
val user = createUser(name = secondValue)
@TEGRAXD
TEGRAXD / Penta.kt
Last active March 6, 2021 17:57
Pair And Title - Penta Kotlin Custom Class
data class Penta<out A, out B, out C, out D, out E> (
val first: A,
val second: B,
val third: C,
val fourth: D,
val fifth: E
) : Serializable {
override fun toString(): String = "($first, $second, $third, $fourth, $fifth)"
}