Skip to content

Instantly share code, notes, and snippets.

View swanav's full-sized avatar
:octocat:

Swanav Swaroop swanav

:octocat:
View GitHub Profile
@swanav
swanav / b64_encode.py
Created March 5, 2022 10:37
Create a base64 string for a file
import argparse
import base64
def main(args):
file_content = None
with open(args.input, 'rb') as f:
file_content = f.read()
b64_content = base64.b64encode(file_content)
@swanav
swanav / db.json
Last active March 2, 2022 08:43
India : States and Districts
[
{
"name": "Andaman and Nicobar Islands",
"districts": [
{
"name": "Nicobar"
},
{
"name": "North and Middle Andaman"
},
@swanav
swanav / Dockerfile
Created March 2, 2019 20:28
Dockerfile for swanav/esp-idf:ebdcbe8
FROM ubuntu:cosmic-20190131
LABEL maintainer=Swanav<[email protected]>
WORKDIR /home/
RUN apt-get update
RUN apt-get install -y gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing
@swanav
swanav / lwip-diff.diff
Created January 17, 2019 11:22
Diff file for esp-lwip vs lwip_nat
This file has been truncated, but you can view the full file.
diff --git a/src/Filelists.mk b/../lwip_nat/src/Filelists.mk
index 7d30bb8f..513539e6 100644
--- a/src/Filelists.mk
+++ b/../lwip_nat/src/Filelists.mk
@@ -42,6 +42,8 @@ COREFILES=$(LWIPDIR)/core/init.c \
$(LWIPDIR)/core/raw.c \
$(LWIPDIR)/core/stats.c \
$(LWIPDIR)/core/sys.c \
+ $(LWIPDIR)/core/altcp.c \
+ $(LWIPDIR)/core/altcp_tcp.c \
@swanav
swanav / eos.m
Created November 22, 2018 04:01
Economical Optimization w/o G limits.
clc; clearvars;
lambda = 6;
a = [0.004 0.006 0.009];
b = [5.3 5.5 5.8];
c = [500 400 200];
Pd = 800;
error = 100;
tolerance = 0.001;
k = 0;
@swanav
swanav / pbp.m
Created November 22, 2018 04:00
Point by Point Method
clc;
clearvars;
t = 0;
tf = 0;
tfinal = 0.5;
tc = 0.125;
tstep = 0.005;
M = 2.52/(180*50);
i = 2;
@swanav
swanav / Z_Bus_Assembly.m
Last active November 17, 2020 12:09
Z Bus Building Algorithm
function zBus = Z_Bus_Assembly()
% Reads a csv file storing line data
% line sending_node receiving_node line_impedance
lineData = csvread('z_bus_data.csv', 1, 0);
% Find the number of lines and nodes in the imported line data
lines = length(lineData(:, 1));
nodes = max(max(lineData(:, 2)), max(lineData(:, 3)));
@swanav
swanav / Assignment 3.c
Created February 19, 2018 13:30
Lab Assignnment 3 for Data Structures
/*===============================================================================
Lab Assignment 3
Lab 3 (19 Feb 2018)
===============================================================================*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@swanav
swanav / Assignment 1.c
Last active February 13, 2018 09:27
Lab Assignment 1 for Data Structures
#include <stdio.h>
#include <stdbool.h>
/*==============================================================
Data Structures: Lab Assignment 1
Lab 1 (5 February 2018)
Lab 2 (12 February 2018)
==============================================================*/
/**************************************************************
@swanav
swanav / yBusSingular(Mutual).m
Last active February 12, 2018 06:15
Y Bus Assembly (Using Singular Tranformation) for mutually coupled elements
clc; clearvars;
% Data from IEEE 5-bus Data
% "http://shodhganga.inflibnet.ac.in/bitstream/10603/26549/14/14_appendix.pdf""
lineData = ...
[
% line sending bus receiving bus line impedance
1 1 2 0.02+0.060j
2 1 3 0.08+0.240j
3 2 3 0.06+0.250j
4 2 4 0.06+0.180j