Skip to content

Instantly share code, notes, and snippets.

Amit Upadhyay amitu

Block or report user

Report or block amitu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .zshrc
preexec () {
START="$(python -c 'import time; print(time.time())')"
export SHELL_ID="$(python -c 'import uuid; print(uuid.uuid4())')"
precmd () {
if [ -z ${START} ];
amitu /
Last active Aug 3, 2019
citext for diesel/postgresql
diesel print-schema > src/
sed -i '' -e 's/Citext/mycrate::sql_types::Citext/g' src/
amitu /
Last active Sep 6, 2018
SQL Injection Demonstration In Python
acko=# create table tmp_foo (id int);
acko=# insert into tmp_foo values (1);
acko=# insert into tmp_foo values (2);
acko=# insert into tmp_foo values (3);
amitu /
Created Aug 27, 2018
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
amitu /
Last active Apr 10, 2018
Acko's api framework
# -*- coding: utf-8 -*-
# License: BSD
import json
import os
import re
import time
from django import forms
from django.conf import settings
amitu / or.elm
Last active Jun 20, 2017
Elm Enhancement Proposal: Or (More of a thought experiment)
View or.elm
-- What if we have had an or keyword for creating types.
-- Motivation: I often have something that is of few other things.
-- Example 1 from my code:
-- this is my Main Msg. Main does not have any UI, it is an SPA, it delegates different
-- pages / Modules for UI and updated etc.
type Msg
View gist:fe548a624136a8be1031c0417062114e
### Keybase proof
I hereby claim:
* I am amitu on github.
* I am amitu ( on keybase.
* I have a public key whose fingerprint is 0AE6 B0E1 9D24 7DD8 4DD0 2BB2 1514 4294 2930 5B79
To claim this, I am signing this object:
amitu /
Created Aug 16, 2016
service oriented architecture for django: pseudo code
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
class Settings(object):
def __init__(self):
self.settings = dict(
amitu / com.amitu.waitforit.plist
Created Jun 10, 2016
waitforit launch agent plist for mac
View com.amitu.waitforit.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
amitu /
Last active Apr 29, 2016
Django Model base class for encoded key. Useful for when you want to pass id in URL or JSON, but do not leak data to world (about how many objects you have of that kind).
from Crypto.Cipher import AES
from Crypto import Random
import base64
import binascii
import struct
from django.db import models
from django.conf import settings
You can’t perform that action at this time.