Skip to content

Instantly share code, notes, and snippets.

View vandycknick's full-sized avatar
⚠️
Oops, something went wrong!

Nick Van Dyck vandycknick

⚠️
Oops, something went wrong!
View GitHub Profile
@vandycknick
vandycknick / notes-sync.sh
Last active January 3, 2023 23:08
A little script to sync my notebook on different devices.
#!/usr/bin/env bash
#The MIT License (MIT)
#Copyright (c) 2023 Nick Van Dyck
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without #limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following #conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO #EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OU
@vandycknick
vandycknick / busybox-install.sh
Last active March 16, 2022 16:06
Quickly install buxybox
#! /usr/bin/env bash
# Run with bash -c 'eval "$(curl -sfL https://gist.githubusercontent.com/vandycknick/53b0b09fa52a2670fe3afca2ee93c64c/raw/36ddeaf92e424e54bfeca64d6b0baf41119b764e/busybox-install.sh)"'
VERSION=1.35.0
ARCHITECTURE=x86_64
BIN_DIR=/tmp/bin
UTILS=(
"acpid" "addgroup" "adduser" "adjtimex" "ar" "arp" "arping" "ash"
import re
import enum
import argparse
import functools
# Capabilities generated with
# curl -s https://raw.githubusercontent.com/torvalds/linux/3aaf0a27ffc29b19a62314edd684b9bc6346f9a8/include/uapi/linux/capability.h | grep -i '^#define CAP_.*[0-9]$' | awk '{ printf "%s=%s\n",$2,$3; }'
class Capability(enum.Enum):
CAP_CHOWN = 0
CAP_DAC_OVERRIDE = 1
@vandycknick
vandycknick / Dockerfile
Last active June 5, 2020 19:34
Docker Volumes
FROM node:alpine
WORKDIR /app
RUN echo "hello" > hello-world.txt

Keybase proof

I hereby claim:

  • I am nickvdyck on github.
  • I am nickvandyck (https://keybase.io/nickvandyck) on keybase.
  • I have a public key whose fingerprint is 01C4 AA25 67C9 B257 8012 C385 05B4 8F7F BCDC C54E

To claim this, I am signing this object:

@vandycknick
vandycknick / use-redux.js
Last active March 1, 2019 10:56
React Hook recipe to access state and dispatch redux actions. Demo: https://codesandbox.io/s/8n1o5n135l
import { createContext, useContext, useEffect, useRef, useState } from 'react';
import shallowEqual from 'shallowequal';
const StoreContext = createContext(null);
const Provider = StoreContext.Provider;
const useDispatch = () => {
// Get the provided store from the current StoreContext
const store = useContext(StoreContext);
var fs = require('fs');
fs.readFile('./map-pin-default.png', function(err, buffer) {
if(err) {
console.log(err);
}else {
var list = parsePng(buffer);
var tEXt = list[1];
var iTXt = list[2];