Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@badsyntax
badsyntax / build-ios.sh
Created January 12, 2022 05:16
react native build benchmarks
#!/usr/bin/env bash
echo
echo "!!!! BUILDING IOS, PLEASE WAIT... !!!!!"
echo
npm ci
npm run lint
npm run markdown-link-check
sleep 1
@badsyntax
badsyntax / instructions.md
Last active January 4, 2022 10:47
Storybook webpack 5 typescript ESM

storybook-webpack5-esm-typescript

The following instructions are collated from storybookjs/storybook#14877

mkdir storybook-esm-react-webpack5
cd storybook-esm-react-webpack5
npm init -y

# manually add "type":"module" to package.json
@badsyntax
badsyntax / s3etag.sh
Last active December 16, 2021 13:47 — forked from emersonf/s3etag.sh
Generate an S3 ETAG for a multipart upload file, on MacOS
#!/bin/bash
# Generate an S3 ETAG for a multipart upload file.
#
# From: https://gist.github.com/emersonf/7413337
# Author: Emerson Farrugia <https://github.com/emersonf>
# Modified by: Richard Willis <https://github.com/badsyntax>
# Modifications: Work with bytes instead of MB.
#
# MacOS only!
@badsyntax
badsyntax / s3Etag.ts
Last active December 19, 2021 07:10
Generate an S3 ETAG for multipart uploads in Node.js
/**
* Generate an S3 ETAG for multipart uploads in Node.js
* An implementation of this algorithm: https://stackoverflow.com/a/19896823/492325
* Author: Richard Willis <willis.rh@gmail.com>
*/
import fs from 'node:fs';
import crypto, { BinaryLike } from 'node:crypto';
const defaultPartSizeInBytes = 5 * 1024 * 1024; // 5MB
#!/usr/bin/env bash
# Clear watchman watches
watchman watch-del-all 2>/dev/null
# Delete metro cache
rm -rf "${TMPDIR:-/tmp}"/metro-*
# local xcodebuild cache
cd ios/
@badsyntax
badsyntax / build-ios.sh
Last active October 21, 2021 07:20
build-ios.sh
#!/usr/bin/env bash
echo
echo "!!!! BUILDING IOS, PLEASE WAIT... !!!!!"
echo
npm ci
npm run lint
npm run markdown-link-check
npm run test -- --no-watchman
@badsyntax
badsyntax / android-emulator-setup.yml
Created August 4, 2021 12:39
Setup the android emulator on Azure Devops Pipelines
# NOTE: must be run on a MacOS Agent!
steps:
- script: |
# Install AVD files
yes | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-29;default;x86_64'
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# Create emulator
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_29_AOSP -d pixel --package 'system-images;android-29;default;x86_64' --force
@badsyntax
badsyntax / iterm2.plist
Created July 21, 2021 10:44
iterm2 prefs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleAntiAliasingThreshold</key>
<integer>1</integer>
<key>ApplePressAndHoldEnabled</key>
<false/>
<key>AppleScrollAnimationEnabled</key>
<integer>0</integer>
@badsyntax
badsyntax / .gitconfig
Created June 24, 2021 07:45
.gitconfig
[color]
ui = auto
[push]
default = current
[commit]
verbose = true
[color "branch"]
@badsyntax
badsyntax / deploy.yml
Created June 18, 2021 05:33
portainer docker swarm CD (GitHub Actions)
name: Deploy
on:
workflow_dispatch:
push:
branches:
- master
jobs:
publish-docker-image:
name: Publish docker image