Skip to content

Instantly share code, notes, and snippets.

View sansyrox's full-sized avatar
🐶
Exiting Vim!!!

Sanskar Jethi sansyrox

🐶
Exiting Vim!!!
View GitHub Profile

Student : Sanskar Jethi
Github : stealthanthrax
Organisation : FOSSASIA

SUSI_Chromebot: Susi_chromebot is a light extension made in replacement for susi.ai web app.

Issues : link

@sansyrox
sansyrox / myscript.sh
Created May 20, 2018 20:03 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@sansyrox
sansyrox / myscript.sh
Created May 20, 2018 20:03 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@sansyrox
sansyrox / sanskarwork.md
Last active September 23, 2018 11:47
GSoC 2018 Work Product - Sanskar Jethi
@sansyrox
sansyrox / mysql_cheat_sheet.md
Created October 22, 2019 13:52 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@sansyrox
sansyrox / tail.py
Created January 26, 2020 19:48
Create a Program to Imitate the working of the tail command in Linux
from collections import deque
def get_last(filename, n=5):
"""
Returns the last n lines from the file
"""
try:
with open(filename) as f:
return deque(f, n)
@sansyrox
sansyrox / heap.py
Created February 23, 2020 19:56
Dijkstra's
from collections import defaultdict
from heapq import *
def dijkstra(edges, f, t):
g = defaultdict(list)
for l,r,c in edges:
g[l].append((c,r))
q, seen, mins = [(0,f,())], set(), {f: 0}
while q:
@sansyrox
sansyrox / parse_csv.py
Created March 17, 2020 15:36 — forked from amaciel81/parse_csv.py
Import a CSV file. If condition is met, print two attributes for that condition
from csv import reader as csv_reader
with open("sample_input.csv") as input_fh:
people = csv_reader(input_fh)
headers = next(people)
for row in people:
person = (dict(zip(headers, row)))
if int(person["age"]) >= 30:
print("Name: {name}, City: {city}".format(name=person["name"], city=person["city"]))
@sansyrox
sansyrox / parse_json.py
Created March 17, 2020 15:36 — forked from amaciel81/parse_json.py
Import a JSON file. If condition is met, print two attributes.
from json import load as json_load
with open("sample_input.json") as input_fh:
people = json_load(input_fh)
for person in people["people"]:
if person["age"] >= 30:
print("Name: {name}, City: {city}".format(name=person["name"], city=person["city"]))