Skip to content

Instantly share code, notes, and snippets.

class DFA:
def __init__(self, states, alphabet, transition_function, start_state, accept_states):
self.states = states
self.alphabet = alphabet
self.transition_function = transition_function
self.start_state = start_state
self.accept_states = accept_states
self.current_state = start_state
def transition(self, symbol):
@vkalintiris
vkalintiris / parser.py
Created July 21, 2023 08:23
Strip likely/unlikely
#!/usr/bin/env python3
import sys
def find_nested_parentheses_locations(program):
stack = []
nested_locations = []
for index, char in enumerate(program):
if char == '(':
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
set -g mouse off
set -g history-limit 64000
bind c new-window -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
//cc -Wextra -o build/dump-header-map dump-header-map.c
// see: https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMapTypes.h
// https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMap.h// https://github.com/llvm-mirror/clang/blob/release_40/lib/Lex/HeaderMap.cpp
// This is basically dump() from there.
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <err.h>
@vkalintiris
vkalintiris / Apple_mobile_device_types.txt
Created November 16, 2018 16:29 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)