Skip to content

Instantly share code, notes, and snippets.


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
Make sure to enable ssh
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 /
Created May 16, 2022 — forked from Thiagobc23/
Gantt Chart with Matplotlib v2
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 /
Last active Apr 17, 2022
Getting around Python recursion limit
def cps(gen):
stack = [gen]
ret = None
while stack:
value, ret = ret, None
res = stack[-1].send(value)
except StopIteration as e:
def to_stack(ds):
expanded = []
to_expand = [ds]
while to_expand:
ds, *to_expand = to_expand
if type(ds) in {list, set, tuple}:
to_expand = list(ds) + to_expand
elif type(ds) in {dict}:
vrthra /
Created Mar 2, 2022 — forked from vimtaai/
Comparison of features in various Markdown flavors

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*
Insertion* Highlight* Footnote Task list Table Abbr Deflist Smart typo TOC Math Math Block Mermaid
vrthra /
Created Feb 10, 2022 — forked from oinume/
Capture stdout/stderr in Python
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 /
Last active Sep 29, 2021
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 = []
import random
# 5 20 26 33 35 37 62 74 95 98
class NT:
def __init__(self):
self.children = []
self.depth = 0
def __str__(self):
vrthra /
Last active Sep 23, 2021
Import Module.
# ---
# 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