Skip to content

Instantly share code, notes, and snippets.

View tejashah88's full-sized avatar

Tejas Shah tejashah88

View GitHub Profile
@tejashah88
tejashah88 / comsc-165-common-lib.c
Last active October 16, 2018 06:02
List of common functions used in COMSC-165.
int readInt();
char readChar();
float readFloat();
string readWord();
string readLine();
void swapInt(int &a, int &b);
void swapChar(char &a, char &b);
void swapFloat(float &a, float &b);
void swapString(string &a, string &b);
@tejashah88
tejashah88 / numerical_integration.py
Last active September 25, 2018 16:18
numerical integration + error analysis in python 3 (Source: http://www2.engr.arizona.edu/~edatools/Phys305/integration.html)
def check_params(h, nbins):
assert type(nbins) == int
assert h > 0
get_delta = lambda a, b, nbins: float(b - a) / nbins
def integLeft(a, b, f, nbins):
"""Return the integral from a to b of function f using the left hand method"""
h = get_delta(a, b, nbins)
assert type(nbins) == int
@tejashah88
tejashah88 / gitify.bat
Created July 26, 2017 09:49
A batch script that can add git support to any coding project.
if exist ".git" (
rmdir /S /Q .git
)
git init
git remote add origin https://github.com/%1.git
git pull origin master
for %%A IN (%*) DO (
if "%%A"=="--pause" (
@tejashah88
tejashah88 / gen-ssl-files.sh
Created January 29, 2017 06:16
This script allows you to generate the needed SSL certificates and other files.
#!/bin/bash
# Source: OpenSSL Certificate Authority: https://jamielinux.com/docs/openssl-certificate-authority/index.html
# A function which pauses execution until 'Enter' is pressed
# If at least one parameter is given, that parameter will be displayed instead
pause() {
if [ $# -eq 0 ]
then
read -rsp $'Press enter to continue...\n'