Skip to content

Instantly share code, notes, and snippets.

View bswinnerton's full-sized avatar

Brooks Swinnerton bswinnerton

View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active October 14, 2024 00:05
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@starlinq
starlinq / nuc7refusestoboot.md
Last active September 6, 2024 13:25
How to fix Intel NUC that refuses to boot

Recently I have got a problem. My NUC7 refused to boot OS. The sympthom was exact as in this posting. The power button turned to solid amber/orange color (no blinking).

I've tried holding the power button for any length between 3 to 15 seconds, no changes.

Fortunately I solved the problem following an advice from Intel NUC community. The link to possible solutions is here.

I diassembled the NUC7 to reach an opposite side of the main board (with cooling fan and CMOS battery). I disconnected the battery for 15 minutes, and then connected it again. It solved the problem with power indicator and booting.

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@nickvanw
nickvanw / snmp.yml
Created March 24, 2018 22:41
SNMP Exporter for EdgeRouter
default:
auth:
community: thisisasecret
walk:
- 1.3.6.1.2.1.1.3
- 1.3.6.1.2.1.2
- 1.3.6.1.2.1.31.1.1
metrics:
- name: sysUpTime
oid: 1.3.6.1.2.1.1.3
@satendra02
satendra02 / app.DockerFile
Last active October 21, 2024 06:09
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:

Setting up netboot.xyz with an EdgeRouter

This document covers how to setup netboot.xyz, a service that provides iPXE-based installation and live boot of a bunch of operating systems, on a Ubiquiti EdgeRouter.

Assumptions

I've made a few assumptions throughout this document that will probably be different for your setup:

@voluntas
voluntas / sysctl.conf
Created October 14, 2017 13:07 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@aroben
aroben / stackprof-to-flamegraph
Created March 6, 2017 21:20
Script to generate flamegraphs from Ruby stackprof profiles
#!/bin/sh
# First generate a profile using https://github.com/tmm1/stackprof
# StackProf.run(raw: true, out: "tmp/stackprof.dump) { something_expensive }
# Then run this script
# $ stackprof-to-flamegraph tmp/stackprof.dump
set -e
if [ "$STACKCOLLAPSE" = "1" ]; then
template="/tmp/stackprof-$$"
@itzg
itzg / README libvirt cloud-init with static networking.md
Last active September 9, 2024 11:45
Configuring a libvirt domain with a static IP address via cloud-init local datasource

Here is how to create a cloud-init disk image and OS disk image suitable for configuring into a libvirt domain file.

In my case I am naming my domain (a.k.a. virtual machine or VM) xenial with a static IP address of 192.168.0.101. The filenames "network-config" and "user-data" files are arbitrary, so they can be named with a prefix for the domain, etc.

First, get the cloud image and convert into QCOW2 format:

qemu-img convert -O qcow2 xenial-server-cloudimg-amd64-disk1.img xenial-server-cloudimg-amd64-disk1.qcow2
@renatorib
renatorib / operator_with_ligatures.md
Last active January 11, 2024 06:45
Using Operator Mono with Fira Code ligatures in Atom.

Using Operator Mono with Fira Code ligatures in Atom.

  1. Open your Atom's Stylesheet
    image

  2. Put this css

atom-text-editor {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;