Skip to content

Instantly share code, notes, and snippets.

View alexispurslane's full-sized avatar

Alexis Purslane alexispurslane

View GitHub Profile
@alexispurslane
alexispurslane / init.el
Last active June 6, 2024 16:49
Kira's init
(setq gc-cons-threshold-original gc-cons-threshold)
(setq gc-cons-threshold most-positive-fixnum)
(run-with-timer 5 0 (lambda ()
(setq gc-cons-threshold gc-cons-threshold-original)
(message "Restored GC cons threshold")))
;;; ======Prelude======
(require 'cl-lib)
(require 'rx)
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
@alexispurslane
alexispurslane / devil-layer.el
Created June 1, 2024 15:23
The basic starter leader-key configuration, for people that want Doom Emacs/Spacemacs like leader keys and don't know where to start. Should only use built-in vanilla Emacs commands!
;;;; Spacemacs/Doom-like evil mode leader key keybindings layer
(defun optional/devil-layer ()
"Define Spacemacs/Doom-style leader keys. This is
high-maintinence, as you won't be able to use any of the
keybindings that come with any Emacs commands or modes by
default, you'll have to bind your own keybindings for all of
them. However, this is the most ergonomic and logical from a
first-principles point of view."
(with-eval-after-load "general"
;;;;;; Create the mode-specific leader key mapping function
@alexispurslane
alexispurslane / org-static-blog-layer.el
Last active June 1, 2024 13:51
Use org mode and emacs to directly generate your blog, no external programs needed!
(defun optional/blog-layer ()
"Blog writing is one of the most common writing tasks there
is. With the existing `task/writing-layer' you should have all
you need to write blog entries, but in case you want to fully
generate and manage your entire blog from inside Emacs, then this
layer is for you.
Loads:
- `async`: so you can run the blog build in the background.
- `org-static-blog': A beautifully simple SSG for org."
@alexispurslane
alexispurslane / eshell-layer.el
Last active June 7, 2024 22:03
Switching from modern, blingful shells like Fish or Nushell to Eshell, and want an eshell config that will feel excellent, modern, and versitile? This is for you.
(defun user/eshell-layer ()
"Make eshell feel like a hyper-modern, advanced, featureful
shell, like Fish or Nushell. Also make eshell output read-only
to avoid confusion.
Loads:
- `eshell-prompt-extras': three beautiful, useful modern prompt
themes, and better tools for building your own.
- `esh-autosuggest': automatically suggest (in grayed out text)
commands from your history based on your current command, which
@alexispurslane
alexispurslane / gnus-proton-mail-layer.el
Last active June 1, 2024 13:53
A complete and fully-working (including STARTTLS encryption and HTML emails) setup to use Proton Mail Bridge with emacs
(defun user/mail-layer ()
"Set GNUS up with asynchronous mail sending, and Proton Mail support,
and a relatively modern layout!
Loads:
- `async': for asynchronous mail"
(use-package async
:demand t
:config
(load "smtpmail-async.el")
@alexispurslane
alexispurslane / tramp-distrobox-layer.el
Last active June 1, 2024 13:47
Want to use Emacs's TRAMP to transparently enter containers you're using as distroboxes/devcontainers? Here's how.
(defun user/tramp-layer ()
"Enable TRAMP to use distrobox to transparently enter containers."
(use-package tramp
:commands (eshell shell term ansi-term)
:custom
(tramp-histfile-override "/dev/null")
:config
(add-to-list 'tramp-remote-path 'tramp-own-remote-path) ; make sure TRAMP/any shell you use checks the path variable of the container as well as its own
(message "Loading tramp...")
;; TRAMP 2.7.1 will have distrobox built in, so this won't be necessary for much longer!
@alexispurslane
alexispurslane / project-tramp.md
Last active May 27, 2024 02:11
If you're trying to add a project using `project.el` that git deems of "dubious" ownership, `project.el` will crash. Here's a nice fix.

As the tagline says, if you're trying to use Emacs's built-n project-management package, project.el, to add a git version-controlled project that git deems untrustworthy and then do a project-find-{files,dir} on it, it will currently crash, because the output of the git ls-files outputs a bunch of errors to stderr and nothing to stdout, and it doesn't expect to have an empty list of files and directories. To resolve this, I've created a nice snipped of code that will detect, when you add a project, whether git deems it unsafe (git ls-files returns code 128 to mean that) and ask you whether you want to add it to your list of safe directories:

(advice-add 'project-remember-project
                :before (lambda (pr &optional something)
                            (when (and (eq 'Git (cadr pr))
                                       (let ((default-directory (caddr pr)))
                                           (= (shell-command "git ls-files") 128)))
                                (when (y-or-n-
@alexispurslane
alexispurslane / language-sizes.md
Last active January 2, 2024 23:38
An Informal Look At Language Sizes in 2023

An Informal Look At Language Sizes in 2023

Note

We are not counting standard library specifications, since not every language included specifies their standard library as part of the language specification, so it wouldn't be fair, and also the size of a standard library is usually a positive thing whereas the size of the language itself is usually a negative thing so including both of those in the same statistic would be misleading.

Note

Where a language specification was not available and a cursory review of the language reference revealed that the reference was roughly as rigorous as a specification would be — including a formal grammar and specification of semantics alongside a few examples — the reference was used in place of a specification.

Note

While all of the language specifications and the OCaml language reference were all available as PDFs and use similar font sizes and formatting, the pdf version of the Rust reference manual merely printed out the web page and ended up wi

A finite state machine is a way of representing the logic of a system that has some kind of internal state. It defines a set of distinct states which a system can be in, as well as which states can transition to which other states and which inputs make the state change from one to another. For example, a simple finite state machine might represent a train with three states: Boarding, InTransit, and Disembarking. The train starts out in the Boarding state, and from the Boarding state can only go to InTransit (since people don't get on a train just to get off again). Once the train is InTransit, it can only either stay that way, or go to Disembarking. Only when it is in the Disembarking state can it go to the Boarding state again, since you can't board a train before it's empty. The transitions between these states would happen according to some input to the machine from somewhere else in your program --- maybe a "next" button, for instance.

There are two kinds of finite state machines: Mealy machines, and Moo

title tags
Verilog and Vivado Basics
cmpen331

1. Types of Verilog

There are two basic ways that you can write a Verilog program:

  1. Structural Verilog: this is where you specify the logic gates and connections between them of your circuit directly, as if you were doing a textual version of drawing logic gate circuits. This is very low level and nitty-gritty. Here's an example of what that looks like: