Skip to content

Instantly share code, notes, and snippets.

View razor-x's full-sized avatar

Evan Sosenko razor-x

View GitHub Profile
import type { Middleware, createWithEdgeSpec } from 'edgespec'
const users: Record<string, { userId }> = {
fake_api_key1: { userId: 'fake-user-id-1' },
}
const withApiKey: Middleware = (req, ctx, next) => {
const apiKey = req.headers.get('authorization').split('Bearer ')
req.user = users[apiKey]
return next()
sudo mkdir /efi
# move efi mount
sudo rm -rf /boot/efi
# remove linux bootloader and kernals on /efi
# backup /boot
# reformat /boot to vfat
# copy /boot data back
# update UUID in fstab
sudo systemctl disable efistub-ucode-update@linux.path
sudo systemctl disable efistub-ucode-update@linux.service
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
@razor-x
razor-x / functions.yaml
Last active May 3, 2024 12:39
Sentry.io CloudFront Lambda@Edge tunnel
# TODO: Setup https://github.com/silvermine/serverless-plugin-cloudfront-lambda-edge
sentryOriginReq:
handler: handlers/handler.default
lambdaAtEdge:
distribution: AppDistribution
eventType: origin-request
includeBody: true
pathPattern: /_tunnel # TODO: Choose tunnel path.
@razor-x
razor-x / apollo-client.ts
Last active December 22, 2022 10:41
AppSync using Apollo Client with subscription support, and custom domain via Lambda@Edge
import type {
NormalizedCacheObject,
PossibleTypesMap,
Resolvers,
TypePolicies
} from '@apollo/client'
import {
ApolloClient as Client,
InMemoryCache,
createHttpLink,
@razor-x
razor-x / delete-versions.js
Created June 2, 2021 04:12
Delete GitHub package versions
import { createHttpClient } from '@meltwater/mlabs-http'
export default ({ githubOrg, githubToken, log }) =>
async (packageName, packageType = 'container') => {
if (!packageName) throw new Error('Missing packageName')
const client = createPackagesClient({
packageName,
packageType,
org: githubOrg,
@razor-x
razor-x / fp.js
Created March 19, 2019 22:03
Exports for phi and rxjs together
export * from '@meltwater/phi'
export {
noCase,
dotCase,
swapCase,
pathCase,
upperCase,
lowerCase,
camelCase,
snakeCase,
#!/bin/bash
set -e
set -u
if [ ! "${TRAVIS:-}" = 'true' ]; then
echo 'This is not running on Travis CI. Exiting!'
exit 1
fi
@razor-x
razor-x / knife.rb
Last active February 25, 2016 18:36
Portable .chef/knife.rb for Chef projects.
#
# Local Environment
#
home_dir = Dir.home
chef_dir = File.join(home_dir, '.chef')
secret_dir = File.join(chef_dir, 'private')
organization = ENV['chef_org'] || 'the_organization_name'
knife_override = File.join(chef_dir, 'knife_override.rb')
username = (ENV['USER'] || ENV['USERNAME']).downcase
@razor-x
razor-x / README.md
Last active October 16, 2015 05:42
Dota 2 Config

Dota 2 Config

Launch Options

-novid

autoexec.cfg