Skip to content

Instantly share code, notes, and snippets.

View benlongo's full-sized avatar

Ben Longo benlongo

  • VALIS Insights, Inc.
  • Boston, MA
View GitHub Profile
@CuddleBunny
CuddleBunny / tailwind.config.js
Created May 4, 2022 21:40
fast design system + tailwind
// TODO: Create a configuration preset to allow npm based projects to bundle their own tailwind and tree shake? #JoshD
module.exports = {
purge: [],
theme: {
colors: {
accent: {
default: 'var(--accent-fill-rest)',
hover: 'var(--accent-fill-hover)',
active: 'var(--accent-fill-active)'
},
@suhaotian
suhaotian / Echart.tsx
Created November 17, 2021 08:57
echarts with typescript
import React, { useState, useRef, useEffect, useMemo, useLayoutEffect, useImperativeHandle, forwardRef, Ref } from 'react'
import echarts, { ECOption } from './echarts-ref';
export type EchartProp = {
option: ECOption,
style?: {
width: string,
height: string
}
className?: string
@degitgitagitya
degitgitagitya / .env
Last active July 16, 2024 21:01
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@chponte
chponte / gnu-toolchain.md
Last active June 23, 2024 22:39
Building a complete GNU toolchain, comprised of binutils + gcc + glibc
@bert2
bert2 / Option.cs
Last active September 20, 2022 01:28
copy & paste: lightweight implementation of the famous `Maybe` monad/functor with async support
/**
* Lightweight implementation of the famous `Maybe` type that safely wraps
* optional values without using `null` references.
*
* Add this file to your project and get three new namespaces:
* - `Option`: the base type, factories, operators (map, bind, filter, tap,
* flatten), and means to get the contained value.
* - `Option.Extras`: some utility functions like `IEnumerable.FirstOrNone()`,
* combinators (and, or, ...), and maybe-ready `TryParse` functions.
* - `Option.Async`: async variants of the operators so you can bind against
@Nolan-Walker
Nolan-Walker / README.TXT
Last active November 25, 2021 20:50
CONFIGURATION OF THE MOXA UC-8112-MET GATEWAY FOR INTEGRATION WITH SCADA SYSTEM AND FIELD DEVICES IN THE OIL & GAS INDUSTRY (MAY APPLY TO OTHER PROCESS INDUSTRIES AS WELL)
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#CONFIGURATION OF THE MOXA UC-8112-MET GATEWAY FOR INTEGRATION WITH SCADA SYSTEM AND FIELD DEVICES IN THE OIL & GAS INDUSTRY (MAY APPLY TO OTHER PROCESS INDUSTRIES AS WELL)
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------
#Author: Nolan Caissie | nolancaissie.ece@gmail.com | 27/03/2020
#---------------------------------------------------------------
#The following document provides the necessary information to install ThingsPro2 and Node-Red on the Moxa UC-8112-MET. This should work with other Moxa edge computers running Linux Debian 9 (or possibly later debian-based distros).
#The 5 part tutorial on the subject (recommended) is located at: https://www.y
@mdawaffe
mdawaffe / diff-changed-lines.sh
Last active October 4, 2023 08:38
Get line numbers of changed lines - git, diff - Full of bashisms
#!/bin/bash
# Call like you would `diff`
# `./diff-changed-lines.sh old new`
# Outputs the lines numbers of the new file
# that are not present in the old file.
# That is, outputs line numbers for new lines and changed lines
# and does not output line numbers deleted or unchanged lines.
@tautologico
tautologico / buildcrossgcc.sh
Last active March 18, 2024 11:43
Build gcc cross-compiler for armv7-a (Cortex-A)
#!/bin/sh
# Download binutils, gcc, the linux kernel, glibc
# define the prefix
export PREFIX=/opt/armhf
# change PATH to include the target directory
export PATH=$PREFIX/bin:$PATH
@kdrakon
kdrakon / Avro4s.scala
Last active December 16, 2022 15:29
Using Avro4s with Confluent Kafka Avro Serializer + Schema Registry
import java.util
import com.sksamuel.avro4s.RecordFormat
import org.apache.avro.generic.GenericRecord
import org.apache.kafka.common.serialization.{Deserializer, Serde, Serializer}
object Avro4s {
implicit class CaseClassSerde(inner: Serde[GenericRecord]) {
def forCaseClass[T](implicit recordFormat: RecordFormat[T]): Serde[T] = {
val caseClassSerializer: Serializer[T] = new Serializer[T] {
#!/bin/bash
# Version of pishrink (https://github.com/Drewsif/PiShrink) to work on Moxa UC-8100 series image
function cleanup() {
if losetup $loopback &>/dev/null; then
losetup -d "$loopback"
fi
}