Skip to content

Instantly share code, notes, and snippets.

exports.handler = async (req) => {
return new Response("Hello World");
}
bun run build-layer -- \
--arch x64 \
--release canary \
--output /path/to/layer.zip
import type { Server, ServerWebSocket } from "bun";
import { AwsClient } from "aws4fetch";
type Lambda = {
fetch: (request: Request, server: Server) => Promise<Response | undefined>;
error?: (error: unknown) => Promise<Response>;
websocket?: {
open?: (ws: ServerWebSocket) => Promise<void>;
message?: (ws: ServerWebSocket, message: string) => Promise<void>;
close?: (ws: ServerWebSocket, code: number, reason: string) => Promise<void>;
#! /bin/sh
export BUN_INSTALL_CACHE_DIR=/tmp/bun/cache
exec /opt/bun --cwd $LAMBDA_TASK_ROOT /opt/runtime.ts
@msacar
msacar / mysql-docker.sh
Created January 12, 2022 14:57 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
#!/bin/sh
# For debugging use iptables -v.
IPTABLES="/sbin/iptables"
IP6TABLES="/sbin/ip6tables"
MODPROBE="/sbin/modprobe"
RMMOD="/sbin/rmmod"
ARP="/usr/sbin/arp"
SECONDS=1
@msacar
msacar / index.js
Last active August 29, 2021 14:14
const process = require("process");
const fs = require("fs");
//Error.log dosyasına hatayı yazar
process.on('uncaughtException', (err, reason) => {
fs.appendFileSync(
'error.log',
`\n[${new Date().toISOString()}] ${reason}: ${err}\n` +
`Stack: ${err.stack}\n`,
{ flag: 'a+' }
process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection:', promise, `${err.message} ${err.stack}`)
process.exit(1)
})
process.on('uncaughtException', err => {
console.log(`Uncaught Exception: ${err.message} ${err.stack}`)
process.exit(1)
})
cd /var/named