Skip to content

Instantly share code, notes, and snippets.

@lapnd
lapnd / cocotb.py
Created October 11, 2022 11:22 — forked from jevinskie/cocotb.py
#
# This file is part of LiteX.
#
# Copyright (c) 2015-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2017 Pierre-Olivier Vauboin <po@lambdaconcept>
# Copyright (c) 2021 Jevin Sweval <jevinsweval@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
from pathlib import Path
import os
@lapnd
lapnd / jtag.py
Created December 13, 2021 16:12 — forked from jevinskie/jtag.py
migen Altera JTAG
# JTAG TAP FSM -------------------------------------------------------------------------------------
class JTAGTAPFSM(Module):
def __init__(self, tms: Signal, tck: Signal, use_ieee_encoding=False, expose_signals=True):
self.submodules.fsm = fsm = ClockDomainsRenamer("jtag")(FSM())
# Debug counter
# self.tck_cnt = tck_cnt = Signal(16)
# self.sync.jtag += tck_cnt.eq(tck_cnt + 1)
fsm.act('test_logic_reset',
If(~tms, NextState('run_test_idle'))
@lapnd
lapnd / SimpleHTTPServerWithUpload.py
Created June 25, 2021 01:53 — forked from smidgedy/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/env python3
########################################################################
#
# Simple HTTP server that supports file upload for moving data around
# between boxen on HTB. Based on a gist by bones7456, but mangled by me
# as I've tried (badly) to port it to Python 3, code golf it, and make
# It a little more robust. I was also able to strip out a lot of the
# code trivially because Python3 SimpleHTTPServer is a thing, and the
# cgi module handles multipart data nicely.
#
@lapnd
lapnd / devops_best_practices.md
Created August 13, 2020 01:37 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud

@lapnd
lapnd / console-log-format-timestamps.js
Created April 16, 2020 10:12 — forked from mikeatlas/console-log-format-timestamps.js
Overrides the console.log (specifically this is for node.js) with an ISO timestamp prefix and still handles string interpolation formats.
function showDate(){
var date = new Date(), str = date.toISOString();
return str;
}
function formatArgs(args){
return util.format.apply(util.format, Array.prototype.slice.call(args));
}
var origLog = console.log;
console.log = function() {
var strDate = " [ " + showDate() + " ] ";
@lapnd
lapnd / eth-utxo.md
Created December 28, 2018 08:27 — forked from alex-miller-0/eth-utxo.md
UTXO tokens on Ethereum

Suppose we wish to model a UTXO system on the EVM. We need to represent UTXO tokens such that all value is preserved when tokens are spent. Note: For this example, we are not concerned about the security of the system and are satisfied with giving authorities the power to create tokens (e.g. as in a plasma system).

Consider the following object:

{
  owner: <address>,
  value: <uint>,
@lapnd
lapnd / get-interface-ip-mask.go
Created December 8, 2018 15:33
Example of getting the IP and netmask of an interface with Golang
package main
import (
"fmt"
"net"
"os"
)
func main() {
mgmtInterface, err := net.InterfaceByName("ens160")
@lapnd
lapnd / get-interface-ip-mask.go
Created December 8, 2018 15:33
Example of getting the IP and netmask of an interface with Golang
package main
import (
"fmt"
"net"
"os"
)
func main() {
mgmtInterface, err := net.InterfaceByName("ens160")
@lapnd
lapnd / get-interface-ip-mask.go
Created December 8, 2018 15:33
Example of getting the IP and netmask of an interface with Golang
package main
import (
"fmt"
"net"
"os"
)
func main() {
mgmtInterface, err := net.InterfaceByName("ens160")
@lapnd
lapnd / README.md
Created October 3, 2018 02:17 — forked from roachhd/README.md
Feed.xml RSS for Jekyll blog on GitHub pages.

Jekyll RSS Feed Templates.

A few Liquid templates to use for rendering RSS feeds for your Jekyll blog. Featuring four kinds of feeds:

  • feed.xml — Renders the 10 most recent posts.
  • feed.category.xml — Only renders posts for a specific category. This example renders posts for a "miscellaneous" category.
  • feed.links.xml — Only contains posts that link to external websites noted by a link variable in the YAML Front Matter. Not a common Jekyll convention, but a good way to generating a linked list.
  • feed.articles.xml — Only showing articles that don't link to external sites; The opposite of feed.links.xml.