Skip to content

Instantly share code, notes, and snippets.

View shiv213's full-sized avatar
💖
vibes

Shiv Trivedi shiv213

💖
vibes
View GitHub Profile
@shiv213
shiv213 / RegularExpressionGenerator.py
Created January 24, 2023 21:49
Creates possible languages of n length over the alphabet {0, 1}, given a regular expression in regular language
# Creates possible languages of n length over the alphabet {0, 1}, given a regular expression
# example (0 + 1)∗ generates set of all strings over {0, 1}
# TODO make it generate all possible strings in language less than or equal to n length
# / represents E empty string
import exrex
it = 2
regex = "(0+1)*001(0+1)*"
# regex = "(0+1)*"
# regex = "(0+1)*0(0+1)*0(0+1)*0(0+1)*"
#!/bin/sh
# Read the settings.
. ./settings.sh
# Start the server.
start_server() {
java -server -Xms${MIN_RAM} -Xmx${MAX_RAM} ${JAVA_PARAMETERS} -jar ${SERVER_JAR} nogui
}
@shiv213
shiv213 / flags.html
Created September 5, 2020 20:12
Simple CSS animation of flags moving across the screen following an animation path.
<section id="animationSection"></section>
<script>parentSection = document.getElementById("animationSection");
for (let i = 0; i < 2977; i++) {
let imgDiv = document.createElement('div');
imgDiv.className = "pathed";
imgDiv.style.animationDelay = i * 350 + "ms";
imgDiv.innerHTML = "<img src='https://www.fg-a.com/American/animated-American-flag.gif' alt='flag'/>";
parentSection.appendChild(imgDiv);
}</script>
<style>#animationSection {
@shiv213
shiv213 / TOTP_Arduino.ino
Last active December 2, 2022 15:20
Arduino code to generate and display a TOTP on a 4 digit 7-segment display using a DS3231 AT24C32 RTC module.
#include "TOTP.h"
#include "RTClib.h"
RTC_DS3231 rtc;
int a = 2;
int b = 3;
int c = 4;
int d = 5;
int e = 12;
int f = 7;
// ==UserScript==
// @name Chortle Cheat
// @namespace http://programmedlessons.org/
// @version 0.3
// @description Takes Chortle quizzes and reviews for you
// @author Shiv Trivedi
// @match http://programmedlessons.org/*
// @grant none
// ==/UserScript==
@shiv213
shiv213 / get_ngrok_url.py
Created September 20, 2018 05:28
Simple Python script to retrieve ngrok tunnel addresses
import requests
r = requests.get('http://localhost:4040/api/tunnels')
datajson = r.json()
msg = ""
for i in datajson['tunnels']:
msg = msg + i['public_url'] + '\n'
print(msg)