Skip to content

Instantly share code, notes, and snippets.

View streamich's full-sized avatar
💰
see bio for funding

Va Da streamich

💰
see bio for funding
  • Metaverse
  • 19:35 (UTC +01:00)
View GitHub Profile
@kingbin
kingbin / gist:9435292
Last active August 19, 2024 19:53
Manually Start/Stop PostgresSQL on Mac
# Stop PostgreSQL from auto starting
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Enable PostgreSQL to auto start
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Start postgres
$ sudo su postgres
Password:
bash-3.2$ pg_ctl -D /Library/PostgreSQL/9.3/data/ start
@ngpestelos
ngpestelos / remove-docker-containers.md
Last active August 20, 2024 19:34
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@bellbind
bellbind / hello-asm.c
Last active August 22, 2018 23:04
[clang][gcc][c][osx] inline asm to syscall on OSX amd64
/* clang hello-asm.c -o hello-asm */
int main() {
long write = 0x2000004; /* syscall "write" on MacOS X */
long stdout = 1;
char * str = "Hello World\n";
unsigned long len = 12;
unsigned long ret = 0;
/* ret = write(stdout, str, len); */
__asm__("movq %1, %%rax;\n"
"movq %2, %%rdi;\n"
@tomysmile
tomysmile / mac-setup-redis.md
Last active December 11, 2024 20:15
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@rgl
rgl / wait_for_http_200.sh
Last active October 30, 2024 23:44
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@jkrems
jkrems / es-module-history.md
Last active August 19, 2024 02:13
History of ES modules

Modules - History & Future

History

@gabeweaver
gabeweaver / react-cognito-auth-js.js
Last active December 18, 2024 13:33
React + Cognito User Pools + Cognito Identity JS Example
/*
This example was built using standard create-react-app out of the box with no modifications or ejections
to the underlying scripts.
In this example, i'm using Google as a social provider configured within the Cognito User Pool.
Each step also represents a file, so you can see how I've chosen to organize stuff...you can do it however
you'd like so long as you follow the basic flow (which may or may not be the official way....but its what I found that works.
The docs are pretty horrible)
const React = require("react");
const Lifecycles = React.createLifecycleEvents({
didMount({ setState }) {
setState({
disabled: false,
});
},
didUpdate({ inputRef }) {
if (document.activeElement !== inputRef.value) {
import { useState, useEffect } from "react";
export type AsyncState<T> =
| { loading: false; error?: undefined; value?: undefined }
| { loading: true; error?: undefined; value?: undefined }
| { loading: false; error: Error; value?: undefined }
| { loading: false; error?: undefined; value: T };
export type AsyncUtils<C extends {}, A extends any[]> = {
setArgs: (args: A | undefined) => void;
@streamich
streamich / json-expression-grammar.md
Last active July 28, 2024 12:37
JSON Expression Grammar

JSON Expression Grammar

An improvised draft of JSON Expression grammar in ABNF:

JsonExpression = "[" Operator Operands "]"        ; JSON-expression is itself a valid JSON array

Operator = JsonLiteral                            ; Operator is any JSON value, but usually a string

Operands = 1*("," Operand) ; Non-nullary expression has at least one operand