Skip to content

Instantly share code, notes, and snippets.

View Fity's full-sized avatar
🎯
Focusing

Fity Yang Fity

🎯
Focusing
View GitHub Profile
@Fity
Fity / app.py
Created September 17, 2024 16:31 — forked from prettyirrelevant/app.py
Using Huey with Flask using application factory. For configuration, follow the djhuey format
# Due to the flexible nature of Flask. This might be __init__.py
from .extensions import huey
def create_app():
app = Flask(__name__)
# add your configurations
# app.config.from_object("settings.local")
huey.init_app(app)
@Fity
Fity / learn.md
Created April 11, 2023 07:47 — forked from rylev/learn.md
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@Fity
Fity / gunicorn.py
Created March 11, 2021 10:04 — forked from kodekracker/gunicorn.py
A config file of gunicorn(http://gunicorn.org/) contains fundamental configuration.
# -*- coding: utf-8 -*-
# Gunicorn(v19.3) Configuration File
# Reference - http://docs.gunicorn.org/en/19.3/settings.html
#
# To run gunicorn by using this config, run gunicorn by passing
# config file path, ex:
#
# $ gunicorn --config=gunicorn.py MODULE_NAME:VARIABLE_NAME
#
@Fity
Fity / flappy.html
Created November 30, 2020 10:08 — forked from gullyn/flappy.html
Flappy bird in 228 bytes (improved!)
<body onload="z=c.getContext`2d`,p=Y=Q=',9|z.fillRect(',setInterval(`c.height=W=300,p?Y<W&&Y>P&Y<P+E|p>9?z.fillText(S++,0${Q}0,Y-=M-=.5,9${Q}p-=8,0${Q}p,P+E,9,W),P))):(p=M=S=0,Y=E=99):(p=W+4,P=S%E)`,24)"onclick=M=9><canvas id=c>
@Fity
Fity / steamGetFloatValue.js
Created April 15, 2020 11:11 — forked from sturadnidge/steamGetFloatValue.js
Gets the float value of a Steam inventory item
'use strict';
/*jshint node:true */
// npm install lodash colors minimist request sync-request
var _ = require('lodash'),
colours = require('colors/safe'),
parseArgs = require('minimist'),
request = require('request'),
requestSync = require('sync-request'),
@Fity
Fity / TurnipPrices.cpp
Created April 13, 2020 10:13 — forked from Treeki/TurnipPrices.cpp
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@Fity
Fity / audit_mixin.py
Created December 13, 2019 08:30 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@Fity
Fity / my_thoughts_on_msgpack.md
Created July 30, 2019 07:58 — forked from frsyuki/my_thoughts_on_msgpack.md
My thoughts on MessagePack

My thoughts on MessagePack

Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.

Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.

My high-level response to the comments

To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.

@Fity
Fity / graphql-patch.py
Last active February 25, 2019 08:52 — forked from ryanwang520/gist:4ad82ff754f266f645f7f4aa1611b317
Analysis For GraphQL Requests
import functools
import graphene
from graphene.utils.str_converters import to_snake_case
from graphql import get_default_backend
import logging
import time
from flask import request, current_app
@Fity
Fity / docker-cleanup-resources.md
Created August 21, 2018 06:31 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm