Skip to content

Instantly share code, notes, and snippets.

Avatar

Rahul Gopinath vrthra

View GitHub Profile
View barrier
~/snap/barrier/<3digit#>/.local/share/barrier/SSL and created the Fingerprints folder
openssl req -x509 -nodes -days 365 -subj /CN=barrier -newkey rsa:4096 -keyout Barrier.pem -out Barrier.pem
openssl x509 -fingerprint -sha1 -noout -in Barrier.pem > Fingerprints/Local.txt
sed -e "s/.*=//" -i Fingerprints/Local.txt
https://superuser.com/questions/656912/synergy-on-mavericks-osx-10-9-and-enable-assistive-devices
Make sure to enable ssh
View gll.py
import sys
def add(L, u, j, R):
R.append((L, u, j))
def pop(s, i, R):
s, (L, i_) = s # pop(s, i, R)
add(L, s, i, R) # check and add
return s, R
def push(s, t):
@vrthra
vrthra / gantt.py
Created May 16, 2022 — forked from Thiagobc23/gantt.py
Gantt Chart with Matplotlib v2
View gantt.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from pandas import Timestamp
##### DATA #####
data = {'Task': {0: 'TSK M',
1: 'TSK N',
2: 'TSK L',
@vrthra
vrthra / recursive_call.py
Last active Apr 17, 2022
Getting around Python recursion limit
View recursive_call.py
# https://speakerdeck.com/dabeaz/generators-the-final-frontier?slide=163
def cps(gen):
stack = [gen]
ret = None
while stack:
try:
value, ret = ret, None
res = stack[-1].send(value)
stack.append(res)
except StopIteration as e:
View recursive_copy.py
def to_stack(ds):
expanded = []
to_expand = [ds]
while to_expand:
ds, *to_expand = to_expand
if type(ds) in {list, set, tuple}:
expanded.append(type(ds))
expanded.append(len(ds))
to_expand = list(ds) + to_expand
elif type(ds) in {dict}:
@vrthra
vrthra / markdown-flavors.md
Created Mar 2, 2022 — forked from vimtaai/markdown-flavors.md
Comparison of features in various Markdown flavors
View markdown-flavors.md

Comparison of syntax extensions in Markdown flavors

I created a crude comparison of the syntax of the various common Markdown extensions to have a better view on what are the most common extensions and what is the most widely accepted syntax for them. The list of Markdown flavors that I looked at was based on the list found on CommonMark's GitHub Wiki.

Flavor Superscript Subscript Deletion*
Strikethrough
Insertion* Highlight* Footnote Task list Table Abbr Deflist Smart typo TOC Math Math Block Mermaid
GFM
@vrthra
vrthra / capture.py
Created Feb 10, 2022 — forked from oinume/capture.py
Capture stdout/stderr in Python
View capture.py
import cStringIO
import sys
class IOCapture(object):
def __init__(self, stdout = True, stderr = True):
self.captured_stdout = None
self.captured_stderr = None
if stdout:
self.captured_stdout = cStringIO.StringIO()
if stderr:
@vrthra
vrthra / remove_epsilons.py
Last active Sep 29, 2021
remove_epsilons.py
View remove_epsilons.py
import string
import itertools
class Grammar:
def __init__(self, g, s):
self.grammar = g
self.start = s
def remove_empty_rule_keys(self):
while True:
keys_to_delete = []
View grammar.py
import random
# 5 20 26 33 35 37 62 74 95 98
#random.seed(98)
class NT:
def __init__(self):
self.children = []
self.depth = 0
def __str__(self):
@vrthra
vrthra / import_module.py
Last active Sep 23, 2021
Import Module.
View import_module.py
# ---
# published: true
# title: Importing Python Modules
# layout: post
# comments: true
# tags: python
# categories: post
# ---
# In the [previous post](/post/2018/09/06/peg-parsing/) I discussed how to