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
@amitu
amitu / soa.py
Created Aug 16, 2016
service oriented architecture for django: pseudo code
View soa.py
# -*- 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
amitu / Triangles.elm
Created Oct 3, 2019
Animated Triangles
View Triangles.elm
module Triangles exposing (main)
import Angle exposing (Angle)
import Animation
import Browser
import Camera3d
import Color
import Direction3d
import Html exposing (Html)
import Length
View .zshrc
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 Aug 3, 2019
citext for diesel/postgresql
View schema.sh
diesel print-schema > src/schema.rs
sed -i '' -e 's/Citext/mycrate::sql_types::Citext/g' src/schema.rs
@amitu
amitu / screenshot.go
Last active Jul 4, 2019
screenshot.go
View screenshot.go
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa -framework Foundation
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
NSData *data;
@amitu
amitu / t.m
Created Mar 21, 2012
changing mac input source (language)
View t.m
#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>
/*###############################################################################
# #
# changeInput #
# #
# author: Stefan Klieme (based on an idea by Craig Williams) #
# created: 2009-11-05 #
# Changes input language #
# Usage: changeInput prints current input language #
@amitu
amitu / sql-injection.org
Last active Sep 6, 2018
SQL Injection Demonstration In Python
View sql-injection.org
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 Aug 27, 2018
OCR using google
View ocr.py
#!/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
#
@amitu
amitu / api.py
Last active Apr 10, 2018
Acko's api framework
View api.py
# -*- coding: utf-8 -*-
# License: BSD
import json
import os
import re
import time
from django import forms
from django.conf import settings
@amitu
amitu / gist:4633274
Created Jan 25, 2013
zsh preexec hook example
View gist:4633274
# less -F: Causes less to automatically exit if the entire file can be displayed on the first screen.
# .zshrc
function printc () {
print "printc" $1
}
autoload -Uz add-zsh-hook
You can’t perform that action at this time.