Skip to content

Instantly share code, notes, and snippets.

View abhishek-jaisingh's full-sized avatar
:electron:
👨‍💻

Abhishek Jaisingh abhishek-jaisingh

:electron:
👨‍💻
View GitHub Profile
@abhishek-jaisingh
abhishek-jaisingh / AdventOfCodeDay7.py
Created December 22, 2015 18:20
Advent of Code Day 7 Python Code Solution PS: Just basic recursion and memoization
def getdata(filename):
d = dict()
with open(filename, "r") as f:
for line in f.readlines():
line = line.replace('\n', '').split(' -> ')
d[line[1]] = line[0]
return d
def evaluate(var, d):
try:
val = int(var)
@abhishek-jaisingh
abhishek-jaisingh / adventofcodeday8.py
Created December 22, 2015 21:59
Advent of Code Day 8 Python Code Solution
def readfile(filename):
with open(filename, "r") as f:
tot = 0
for line in f.readlines():
line = line[:len(line)-1]
l = len(line)
count = 0
print(line)
for ch in line:
if ch in ['\\' ,'\"']:
@abhishek-jaisingh
abhishek-jaisingh / subset_sum.cpp
Created February 9, 2016 10:11
Subset Sum DP
#include <bits/stdc++.h>
using namespace std;
void printer(int** a, int r, int c)
{
cout << endl;
for ( int i = 0 ; i <= r ; i++ )
{
for ( int j = 0 ; j <= c ; j++ )
{
cout << a[i][j] << " ";
@abhishek-jaisingh
abhishek-jaisingh / magic_powder.cpp
Created June 18, 2016 16:11
MAGIC POWDER - binary search approach
#include <bits/stdc++.h>
using namespace std;
#define sd(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define ll long long
ll a[100010], b[100010];
int main()
@abhishek-jaisingh
abhishek-jaisingh / air_india_queries.sql
Last active November 19, 2016 20:54
Queries for the Air India Database
# Check for expired aircrafts
SELECT AcID, Mfg_Date, Type FROM AirCraft JOIN AirCraft_Type ON (AirCraft.Ac_Type = AirCraft_Type.ActID) WHERE YEAR(CURDATE()) - YEAR(Mfg_Date)> 2 LIMIT 10;
# Flights btw airports
SELECT FlId, FlightDate, Fare, Departure, Arrival FROM ((Flight_Schedule JOIN AirFare ON (Flight_Schedule.NetFare=AirFare.AfID)) ) JOIN Route ON (Route=RtID) WHERE Airport='New Delhi' AND Destination='Bangalore';
# Passengers on Flight
SELECT Name, Age, Mobile FROM Transaction JOIN Passenger ON (Transaction.Passenger = PsID) JOIN Contact_Details ON (Contacts=CnID) WHERE Flight=5 ORDER BY Name LIMIT 10;
# Minor Passengers with complete address
@abhishek-jaisingh
abhishek-jaisingh / ubuntu_must_install.md
Last active April 8, 2022 00:08
top things to do after installing a fresh ubuntu
@abhishek-jaisingh
abhishek-jaisingh / ctf_must_have_tools.md
Last active November 30, 2016 10:47
List of most recommended tools for ctf / hacking

CTF / Hacking Must Have Tools

netcat

sudo apt install netcat

sqlmap

 sudo pip install sqlmap
@abhishek-jaisingh
abhishek-jaisingh / python_must_install.md
Created November 30, 2016 10:22
Must have python packages

Python Must Have Packages

Mechanize

pip install mechanize
@abhishek-jaisingh
abhishek-jaisingh / Makefile
Created December 19, 2016 18:45
matxin-eng makefile
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
@abhishek-jaisingh
abhishek-jaisingh / project-euler-19.py
Created March 9, 2020 10:57
Python based Solution to Project Euler Problem 19
# 1 Jan 1901 to 31 Dec 2000
# 1 Jan 1900 Monday => 1 Jan 1901 => Tuesday
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def is_leap(y):
return y % 400 == 0 if y % 100 == 0 else y % 4 == 0
def get_month_days(y, i):
if is_leap(y) and i == 1:
return 29