Skip to content

Instantly share code, notes, and snippets.

View bitwhys's full-sized avatar
⌨️
Building

George Bockari bitwhys

⌨️
Building
View GitHub Profile
@bitwhys
bitwhys / practice_sql_setup.sql
Last active July 29, 2023 15:46
Postgres setup script for the book SQL Practice Problems, by Sylvia Moestl.
CREATE TABLE Categories
(
CategoryID SERIAL PRIMARY KEY,
CategoryName VARCHAR(15) NOT NULL,
Description TEXT
);
CREATE TABLE CustomerGroupThresholds
(
CustomerGroupName VARCHAR(20),
@bitwhys
bitwhys / GLSL-Noise.md
Created August 9, 2021 06:18 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
const getVideoId = url => {
const videoIDRegEx = new RegExp(/v=(\S{11})/)
const matches = url.match(videoIDRegEx)
const [_, video_id] = matches
return video_id
}
@bitwhys
bitwhys / token-generator.js
Created April 22, 2020 22:28 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@bitwhys
bitwhys / grabScren.sh
Created January 15, 2020 23:22
create a gif from dimensions from slop output
# The output of the slop command (from gist) is WIDTHxHEIGHT+X+Y
byzanz-record --duration=15 --x=<X> --y=<Y> --width=<WIDTH> --height=<HEIGHT> --delay=<time-before-start-of-recording> <file-name>.gif
wesbos() {
npx install-peerdeps --dev eslint-config-wesbos
echo "{\"extends\": [\"wesbos\"],\"rules\": {\"no-console\": 2,\"prettier/prettier\":[\"error\",{\"trailingComma\": \"all\",\"semi\": false,\"singleQuote\": true,\"printWidth\": 80,\"tabWidth\": 2}]}}" >> .eslintrc
}
slop -t 0 -b 1 ; notify-send "Selection info" "Area: ${W} x ${Y}px \n Position: X = ${X}px, Y = ${Y}px" && echo ${W}x${H} | xsel -b
@bitwhys
bitwhys / composing-software.md
Created September 8, 2019 00:53 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series
/*
Sample Implementation of Circuit Breaker using hystrixjs in NodeJS
It uses reactive principles
Link : https://www.npmjs.com/package/hystrixjs
*/
var CommandsFactory = require('hystrixjs').commandFactory;
var serviceCommand = CommandsFactory.getOrCreate("Service on port :" + service.port + ":" + port)
.circuitBreakerErrorThresholdPercentage(service.errorThreshold)
.timeout(service.timeout)
@bitwhys
bitwhys / app.yaml
Created July 16, 2019 22:52 — forked from parthghiya/app.yaml
sample yml file for microservices configuration with memory resources limit and cpu limit
apiVersion: v1
kind: Pod
metadata:
name: shopping-management
spec:
containers:
- name: shopping-management
image: shopping-service
resources:
requests: