Skip to content

Instantly share code, notes, and snippets.

View vijaysharmay's full-sized avatar
💭
I may be slow to respond.

Vijay Yellepeddi vijaysharmay

💭
I may be slow to respond.
View GitHub Profile
FROM python:3.7-alpine
RUN apk add gcc libc-dev linux-headers mariadb-dev
RUN pip install django gunicorn mysqlclient
COPY dummy /app/dummy
COPY stupid /app/stupid
COPY manage.py /app
COPY wait-for-mysql.sh /app
WORKDIR /app
EXPOSE 8000
CMD ["./wait-for-mysql.sh", "gunicorn", "dummy.wsgi", "--bind=0.0.0.0:8000"]
@vijaysharmay
vijaysharmay / docker-container-reset.bat
Created December 20, 2020 06:44
BAT file for stopping & removing all containers on Windows
@ECHO OFF
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker stop %%i
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
@vijaysharmay
vijaysharmay / schema.txt
Last active September 3, 2022 05:38
Employee Schema
CREATE TABLE employees (
emp_no INT NOT NULL,
birth_date DATE NOT NULL,
first_name VARCHAR(14) NOT NULL,
last_name VARCHAR(16) NOT NULL,
gender ENUM ('M','F') NOT NULL,
hire_date DATE NOT NULL,
PRIMARY KEY (emp_no)
);
-- current employee snapshot
select
e.emp_no,
CONCAT(e.first_name,' ', e.last_name) as full_name,
e.gender,
ct .title,
d.dept_name,
CAST(datediff(CURRENT_DATE(), e.birth_date) / 365 as UNSIGNED) as age,
CAST(datediff(CURRENT_DATE(), e.hire_date) / 365 as UNSIGNED) as time_in_company,
@vijaysharmay
vijaysharmay / tmux-cheatsheet.markdown
Created March 30, 2018 10:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vijaysharmay
vijaysharmay / README.md
Created March 20, 2018 08:03 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

import subprocess
import os
import glob
import math
from functools import reduce
def getLength(filename):
result = subprocess.Popen(
["ffprobe", filename],
stdout = subprocess.PIPE,
@vijaysharmay
vijaysharmay / celery.sh
Created February 28, 2018 13:23 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@vijaysharmay
vijaysharmay / alphabeta.py
Created November 30, 2015 07:20
Alpha Beta pruning on a Minimax tree in Python
#!/usr/bin/python3
# This can either be run from a command line with python3 alphabeta.py or imported with
# from alphabeta import alphabeta
# USAGE:
# alphabeta(input, start, lower, upper)
#
# Where:
# input is a list form input tree. See example in this file.
@vijaysharmay
vijaysharmay / Weighted-majority-experiment.readme
Created November 28, 2015 05:01 — forked from xiaohan2012/Weighted-majority-experiment.readme
Weighted Majority algorithm used in online learning
Three files are included:
1. `weighted_majority.py`: the weighted majority algorithm
2. `main.py`: the main program which takes a specific beta value and make a list of plots
3. `experiment.sh`: bash script that experiments on a list of beta values. This is a good entry of this gist.