Skip to content

Instantly share code, notes, and snippets.

View zkhan93's full-sized avatar
🎯
Focusing

Zeeshan Khan zkhan93

🎯
Focusing
View GitHub Profile
@zkhan93
zkhan93 / ImagePicker.java
Created June 5, 2017 21:47 — forked from Mariovc/ ImagePicker.java
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
print ''
@zkhan93
zkhan93 / send_email
Created January 3, 2018 18:49
send an email repeatedly
import smtplib
import os, sys
import time
toaddrs = ['hello@colive.in']
msg ='''Subject: #{} some subject
body
'''
fromaddress = username = os.getenv('GMAIL_EMAIL')
#include <stdio.h>
#include <stdlib.h>
#define MAX_ITEM 10
#define max(a,b,c) (a>=b?(a>=c?a:c):(b>=c?b:c))
#define min(a,b,c) (a<=b?(a<=c?a:c):(b<=c?b:c))
#define sum(a,b,c) (a+b+c)
int* readInput(int numberOfItems){
int* input;
if(numberOfItems <= 0){
@zkhan93
zkhan93 / bst.c
Last active February 13, 2023 06:58
WIP: Binary Search Tree implementation in C using array
#include <stdio.h>
#include <stdlib.h>
#define MAX_ITEM 10
#define max(a,b,c) (a>=b?(a>=c?a:c):(b>=c?b:c))
#define min(a,b,c) (a<=b?(a<=c?a:c):(b<=c?b:c))
#define sum(a,b,c) (a+b+c)
int* readInput(int numberOfItems){
int* input;
if(numberOfItems <= 0){
@zkhan93
zkhan93 / oddd leafs in BST
Created February 16, 2018 21:23
Sum of ODD leafs in BST
#include <stdio.h>
#include <stdlib.h>
typedef struct Node Node;
struct Node{
int value;
Node* rchild;
Node* lchild;
Node* rsibling;
};
@zkhan93
zkhan93 / basewebservice.py
Last active July 4, 2018 19:21
python wrapper for web-services endpoints
from abc import ABCMeta, abstractproperty, abstractmethod
from pprint import pformat
from lxml import etree
import logging
import requests
import json
class DictResultMixin(object):
__metaclass__ = ABCMeta
@zkhan93
zkhan93 / simple_nginx_config
Created July 14, 2018 17:01
Simple nginx config for a flask base API(dobby-web), HTML content served as static files
server {
listen 8080;
# path for static files
root /home/pi/dobby-web/app/static;
location / {
try_files $uri /html/$uri.html /404;
}
{
"color_scheme": "Packages/Color Scheme - Default/Celeste.sublime-color-scheme",
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"theme": "Adaptive.sublime-theme",
"translate_tabs_to_spaces": true
@zkhan93
zkhan93 / quotes.json
Last active April 26, 2024 15:20
quotes to be used by conky ;)
[
{
"quote": "Patience Ensures Victory.",
"author": "Ali ibn Abi Talib"
},
{
"quote": "Do for this life as if you live forever, do for the afterlife as if you die tomorrow.",
"author": "Ali ibn Abi Talib"
},
{