Skip to content

Instantly share code, notes, and snippets.

View beeman's full-sized avatar
🐝
Buzzin....

beeman beeman

🐝
Buzzin....
View GitHub Profile
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@beeman
beeman / Dockerfile
Created December 30, 2023 16:44
Minimal example of running a solana-test-validator in a Docker container
# Build the image:
# docker build . -t solana-validator-docker
# Run a basic container:
# docker run --rm -it --init solana-validator-docker:latest
# Run the solana-test-validator and expose port 8899:
# docker run --rm -it --init -p 8899:8899 solana-validator-docker:latest solana-test-validator
#
# Based on Ubuntu 22.04 LTS (Jammy)
FROM ubuntu:jammy
# Set the workdir to $HOME
@beeman
beeman / Dockerfile
Created August 29, 2022 19:38
Docker image with solana-test-validator that works on a Apple M1
FROM debian:bullseye as base
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
WORKDIR /workspace
RUN mkdir -pv "/workspace/bin" && echo 'echo test' > '/workspace/bin/test.sh' && chmod +x '/workspace/bin/test.sh'
ENV PATH="/workspace/bin:${PATH}"
FROM base as builder
@beeman
beeman / app-feature.tsx
Created February 19, 2023 20:23
Basic Solana Provider for React apps - a personal reference.
import { useConnection, useWallet } from '@solana/wallet-adapter-react'
import { useSolana } from './solana-provider'
export function AppFeature() {
const { connection } = useConnection()
const { network } = useSolana()
const wallet = useWallet()
if (wallet.connecting) {
return <div>Connecting wallet...</div>
@beeman
beeman / config.ts
Created July 8, 2021 06:00 — forked from AmazingTurtle/config.ts
openai client
export const DEFAULT_ENGINE = 'davinci';
export const ENGINE_LIST = ['ada', 'babbage', 'curie', 'davinci', 'davinci-instruct-beta', 'curie-instruct-beta'];
export const ORIGIN = 'https://api.openai.com';
export const DEFAULT_API_VERSION = 'v1';
export const DEFAULT_OPEN_AI_URL = `${ORIGIN}/${DEFAULT_API_VERSION}`;
@beeman
beeman / HOWTO.md
Last active October 1, 2021 08:40
Schematic to sort your projects and paths in nx.json, workspace.json (or angular.json) and tsconfig

How to sort the projects and paths in your Nx Workspace

This is now availble on NPM:

yarn add -D @nxpm/cli
yarn nxpm-stack lint
import { Logger, Module } from '@nestjs/common'
import { ServeStaticModule } from '@nestjs/serve-static'
import { ensureDirSync, existsSync, writeFileSync } from 'fs-extra'
import { join } from 'path'
const rootPath = join(__dirname, '..', 'admin')
@Module({
imports: [
// Feature modules here...
{
"angular": {
"alias": ["ng"],
"terms": {
"router": [
{ "label": "In-app navigation: routing to views", "url": "https://angular.io/guide/router" },
{ "label": "Observables in Angular - Router", "url": "https://angular.io/guide/observables-in-angular#router" }
]
}
},
@Injectable()
export class DataService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
constructor() {
super()
}
async onModuleInit() {
await this.$connect()
}