Skip to content

Instantly share code, notes, and snippets.

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

Frank Tackitt kageurufu

🏠
Working from home
View GitHub Profile
@kageurufu
kageurufu / flask.py
Created October 3, 2013 17:42
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)
@kageurufu
kageurufu / 20220210ChiTu L Jupiter english.gcode
Created July 23, 2022 20:44
Elegoo Jupiter stock config
; remove all parameters
M8513
; [[The text after the semicolon is a comment, please modify the corresponding parameters according to the description of the comment, the command after the semicolon will be ignored]]
; The basic format is Mxxx Ixxx, Mxxx Txxx or Mxxx Sxxx, where Ixx (is the letter I, the first letter of integer, not the number 1) followed by an integer, which can be decimal or hexadecimal (starting with 0x) , Pxx, Sxx are followed by floating point numbers
; [Direction control of stepper motor] The directions of I1 and I-1 are just opposite, so if the direction of the motor is wrong, either change the wiring or change this direction parameter
; Z stepper motor direction
M8004 I1
@kageurufu
kageurufu / library.css
Created August 1, 2022 23:38
Steamdeck boot stylesheet with full screen boot video patch
button.DialogButton{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;border:0;font:inherit;overflow:visible;padding:0;margin:2px 0;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;display:block;line-height:32px;color:#dfe3e6;font-size:14px;text-align:center;border-radius:2px;cursor:pointer;width:100%;transition:all .2s ease-out;background:#3d4450;background-position:99% 1%;background-size:300% 300%;position:relative}input.DialogInput::-moz-focus-inner,button.DialogButton::-moz-focus-inner{border:0;padding:0}.DialogInputPlaceholder::placeholder,.DialogInputPlaceholder::-webkit-input-placeholder{color:#969696;font-style:italic}.DialogInputPlaceholder::-ms-input-placeholder,.DialogInputPlaceholder:-ms-input-placeholder{color:#969696;font-style:italic}.PopupFullWindow{height:100%}.FullModalOverlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1500}.FullModalOverlay.NotReadyToRender{background:#000}.FullModalOverlay .ModalPosition_Content{
// ==UserScript==
// @name Thingiverse Zip Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.thingiverse.com/thing:*
// @icon https://www.google.com/s2/favicons?sz=64&domain=thingiverse.com
// @grant none
// ==/UserScript==
@kageurufu
kageurufu / regexbuilder.py
Created February 16, 2022 17:11
Minimal composable regex builder in python
import re
ALLOWED_TYPES = {"comment", "reply", "unsub", "sub"}
class RegexBuilder:
def __init__(self, *parts):
self._parts = []
if parts:
self.add(*parts)
@kageurufu
kageurufu / lambda.js
Last active November 25, 2021 12:44
AWS Lambda Thumbnailer
var async = require("async");
var AWS = require("aws-sdk");
var gm = require("gm").subClass({imageMagick: true});
var fs = require("fs");
var mktemp = require("mktemp");
var THUMB_KEY_PREFIX = "thumbnails/",
THUMB_WIDTH = 150,
THUMB_HEIGHT = 150,
ALLOWED_FILETYPES = ['png', 'jpg', 'jpeg', 'bmp', 'tiff', 'pdf', 'gif'];
@kageurufu
kageurufu / models.py
Last active June 6, 2021 07:37
PostgreSQL JSON Data Type support for SQLAlchemy, with Nested MutableDicts for data change notifications To use, simply include somewhere in your project, and import JSON Also, monkey-patches pg.ARRAY to be Mutable @zzzeek wanna tell me whats terrible about this?
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer, Column
from postgresql_json import JSON
Base = declarative_base()
class Document(Base):
id = Column(Integer(), primary_key=True)
data = Column(JSON)
#do whatever other work
import ctypes
kernel32 = ctypes.windll.kernel32
CreateFileW = kernel32.CreateFileW
CloseHandle = kernel32.CloseHandle
CreateFileW.__doc__ = """HANDLE WINAPI CreateFile(
_In_ LPCTSTR lpFileName,
_In_ DWORD dwDesiredAccess,
_In_ DWORD dwShareMode,
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
flask = "*"
sqlalchemy = "*"
[dev-packages]
@kageurufu
kageurufu / dom.py
Last active May 30, 2019 23:17
Ultra-minimal Python to HTML DOM renderer, using MarkupSafe for escaping
import html
from markupsafe import Markup
class InvalidVoidTag(Exception):
pass
VOID_TAGS = {