Skip to content

Instantly share code, notes, and snippets.

View 2color's full-sized avatar
🚢

Daniel Norman 2color

🚢
View GitHub Profile
@janeczku
janeczku / vultr-coreos-bootstrap.sh
Last active August 13, 2021 15:14
Cloud-config for CoreOS IPXE deployment on Vultr. Provisioning etcd, fleet, private network and docker compatible firewall. #tags: foo, bar
#!/bin/bash
# Cloud-config for CoreOS IPXE deployment on Vultr
##################################################
# This cloud-config bootstraps CoreOS on /dev/vda and provisions:
# - private ip-address on eth1
# - etcd on private network
# - fleet on private network
# - basic firewall (docker compatible)
# - SSHd security hardening
##################################################
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

1. Create an etcd token; store it in Vault or some other secure location
2. Create file /etc/systemd/system/docker.service.d/custom.conf with contents:
[Service]
Environment="DOCKER_OPTS=-H=0.0.0.0:2376 -H unix:///var/run/docker.sock --cluster-advertise eth1:2376 --cluster-store etcd://127.0.0.1:2379"
This needs to be done in cloud-init since CoreOS is super bare-bones and "doesn't" contain support for config mgmt out of the box.
@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@onpaws
onpaws / manifests.yaml
Created May 12, 2019 13:59
Fixed manifests for parity 2.5.0
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: default
name: pv-default-100g-disk01
annotations:
volume.beta.kubernetes.io/storage-class: default
spec:
accessModes:
- ReadWriteOnce
@tj
tj / app.js
Last active October 4, 2021 19:38
const http = require('http')
const rpc = require('./rpc')
/**
* Pets service.
*/
class Pets {
constructor(db = []) {

Addressing feedback from this Gist.

Pagination. Looks like limited to paginate by id. I wanted to paginate by a date field and felt impossible

In the most recent Preview version, (cursor-)pagination can be done by any unique field or combination of fields. For example:

model Post {
  id        Int     @id @default(autoincrement())
  title     String
@mig5
mig5 / ipfs-folder-and-files-publish-poc.py
Last active May 4, 2024 04:00
A PoC showing how to publish a folder containing files to IPFS via Python using requests module
#!/usr/bin/env python3
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The author
# accepts no responsibility for its use, of which you do so at
# your own risk.
import json
import requests
@gmelodie
gmelodie / gh-get-team-ssh-keys.sh
Created July 4, 2022 18:59
Get SSH keys for all the members of a github team
APITOKEN="" # TODO: add your token here (create one: https://github.com/settings/tokens)
# be sure to check if the token hasn't expired!
# for ORG and TEAM, you can get those by navigating to your team on github
# and seeing the url, which will be in the format:
# https://github.com/orgs/{ORG}/teams/{TEAM}/discussions
# e.g. https://github.com/orgs/application-research/teams/a-team/discussions
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active May 5, 2024 15:12
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.