Skip to content

Instantly share code, notes, and snippets.

View digi0ps's full-sized avatar
🐈
dfadfadfadsf

Sriram digi0ps

🐈
dfadfadfadsf
View GitHub Profile
@digi0ps
digi0ps / menu.json
Last active June 25, 2023 12:27
Menu JSON
{
"cuisines": [
{
"name": "North Indian",
"combos": [
{
"name": "Non Veg Meals",
"description": "3 Chapati+ Rice+ Chicken curry+2 Non Veg items (Dry+Gravy)+Salad+Sweet",
"price": 150,
"persons": 2,
@digi0ps
digi0ps / psql_test.sh
Last active April 21, 2020 04:22
Shell script for testing Postgres with and without an active connection.
#! /bin/zsh
zmodload zsh/datetime
start=$EPOCHREALTIME
for i in {1..100};
do
PGPASSWORD=password psql -U localadmin testing -c "select count(*) from pg_stat_activity;" > /dev/null;
done
end=$EPOCHREALTIME
echo "Test 1 Elapsed Time: $((end-start))";
@digi0ps
digi0ps / psql_active.sh
Last active April 19, 2020 08:40
Postgres testing with an active connection
#! /bin/zsh
zmodload zsh/datetime
start=$EPOCHREALTIME
PGPASSWORD=password psql -U localadmin testing \
-c "DO
\$do\$
BEGIN
FOR i IN 1..100 LOOP
@digi0ps
digi0ps / psql_nocp.sh
Last active April 19, 2020 08:40
Postgres testing without active connection
#! /bin/zsh
zmodload zsh/datetime
start=$EPOCHREALTIME
for i in {1..100};
do
PGPASSWORD=password psql -U localadmin testing -c "select count(*) from pg_stat_activity;" > /dev/null;
done
end=$EPOCHREALTIME
echo "Elapsed Time: $((end-start))";
@digi0ps
digi0ps / unsubcribe_from_repos.py
Created November 30, 2019 17:27
Python script to unwatch all repositories of an organization.
from github import Github
# pip install PyGithub
ORG_NAME = 'YOUR_ORG'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'
g = Github(ACCESS_TOKEN)
me = g.get_user()
watching_repos = list(me.get_watched())
watching_orgs_repos = [r for r in watching_repos if r.owner.login == ORG_NAME]
@digi0ps
digi0ps / frontend.md
Last active June 1, 2019 06:51
Frontend Flow

Frontend Flow

/

/ is the default page or the home page.

It will be fetching these from the backend: - categories - popular-destinations

@digi0ps
digi0ps / schema.md
Created May 28, 2019 17:47
Data schema for VISIIT

reVISIT

Data Structure / Schema

Did a brief survey of the existing website to analyse the current data structures.

Notes

  1. The data structures are written in a pseudo schema below (i.e it doesn't define the structure in any language, it's just for you to understand, you can implement it in any database/language).

  2. It's not the permanent structure and doesn't represent the existing as whole. Subject to change.

const initFalling = ball => {
/* Constants */
const ballHeight = 100
const acceleration = 9.8 / 60;
const { innerHeight } = window;
/* Variable to denote the speed of the ball */
let fallingSpeed = 0;
const animateFall = () => {
const top = parseInt(ball.style.top);
@digi0ps
digi0ps / garden.ino
Created April 1, 2018 15:51
Code for our garden automation project
#include <dht.h>
// For DHT11 sensor
dht DHT;
// PINS
#define DHT11_PIN A7
#define SMOISTURE_PIN A0
#define PDIODE_PIN A1
#define LED_PIN D5
#define MOTOR_PIN
@digi0ps
digi0ps / ns2.tcl
Last active March 31, 2018 17:03
A TCL tutorial
# variable and printing
set x 10
set y 25
set z [expr $x*$y]
puts $x
puts "x + y = [expr $x+$y]"
# conditional
if { $x > 9 } {