Skip to content

Instantly share code, notes, and snippets.

View amitu's full-sized avatar
😀
Building fastn.com

Amit Upadhyay amitu

😀
Building fastn.com
View GitHub Profile
@amitu
amitu / actions.py
Last active February 7, 2024 11:20
slides dj stuff
from django import forms
from django.template.defaultfilters import slugify
import django
import fastn.django
from . import models
from .forms import VisibilityField
from slides import renderer_utils
import subprocess
@amitu
amitu / http.ftd
Created January 19, 2023 11:12
http processor example
-- import: fpm/processors
-- ftd.text: todo app
-- record todo-item:
integer id:
caption title:
string status:
body description:
@amitu
amitu / FPM.ftd
Last active December 30, 2022 10:05
ethers ftd demo
-- import: fpm
-- fpm.package: hello
@amitu
amitu / FPM.ftd
Created December 20, 2022 06:37
ftd toggle example
-- import: fpm
-- fpm.package: expander
{
"middleware": {
"critical": false,
"result_type": "list",
"fields": {
"path": "string",
"error": "string",
"form_error": "string"
}
},
@amitu
amitu / Triangles.elm
Created October 3, 2019 15:40
Animated Triangles
module Triangles exposing (main)
import Angle exposing (Angle)
import Animation
import Browser
import Camera3d
import Color
import Direction3d
import Html exposing (Html)
import Length
@amitu
amitu / .zshrc
Created August 8, 2019 07:53
~/cmd.log
preexec () {
START="$(python -c 'import time; print(time.time())')"
LAST_CMD=$1
export SHELL_ID="$(python -c 'import uuid; print(uuid.uuid4())')"
}
precmd () {
LAST=$?
if [ -z ${START} ];
then
@amitu
amitu / schema.sh
Last active June 28, 2020 01:34
citext for diesel/postgresql
diesel print-schema > src/schema.rs
sed -i '' -e 's/Citext/mycrate::sql_types::Citext/g' src/schema.rs
@amitu
amitu / sql-injection.org
Last active September 6, 2018 09:42
SQL Injection Demonstration In Python
acko=# create table tmp_foo (id int);
CREATE TABLE
acko=# insert into tmp_foo values (1);
INSERT 0 1
acko=# insert into tmp_foo values (2);
INSERT 0 1
acko=# insert into tmp_foo values (3);
INSERT 0 1
@amitu
amitu / ocr.py
Created August 27, 2018 12:59
OCR using google
#!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#