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 / 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"