Skip to content

Instantly share code, notes, and snippets.

keyboard shredding

Miguel Mota miguelmota

keyboard shredding
Block or report user

Report or block miguelmota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
miguelmota / alacritty.yml
Created Aug 14, 2019
Normal colors for Alacritty terminal
View alacritty.yml
black: '0x000000'
red: '0xcc0403'
green: '0x19cb00'
yellow: '0xcecb00'
blue: '0x0d73cc'
magenta: '0x0dcdcd'
cyan: '0x0dcdcd'
white: '0xdddddd'
miguelmota / is_brave.js
Created Aug 14, 2019
JavaScript check if browser is Brave
View is_brave.js
const res = await (await fetch('')).json()
const isBrave = res.Answer.includes('Brave')
miguelmota / select_where_time_ago.sql
Created Aug 13, 2019
PostgreSQL select where timestamp is before some time ago
View select_where_time_ago.sql
SELECT * FROM users WHERE created_at >= NOW() - INTERVAL '5 minutes';
miguelmota / omit_spread.js
Created Aug 13, 2019
JavaScript omit property in object spread example
View omit_spread.js
const props = {foo: 1, bar: 2, qux: 3}
const {foo, ...other} = props
console.log(foo) // 1
console.log(other) // {bar: 2, qux: 3}
miguelmota / Dockerfile
Created Aug 12, 2019
Dockerfile golang with cgo
View Dockerfile
FROM golang:1.12rc1-alpine3.9
RUN apk --no-cache add gcc musl-dev
COPY . /go/src/
WORKDIR /go/src/
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o myapp cmd/myapp/main.go
CMD ["./myapp"]
miguelmota /
Created Aug 12, 2019
Bash untar (unzip) contents to directory folder
tar -zxvf build.tar.gz -C /path/outdir --strip-components=1
miguelmota /
Created Aug 12, 2019
Bash tar gzip directory folder
# tar gzip a folder
tar -cv build/ | gzip > build.tar.gz
# unzip a gzip tarball
tar -zxvf build.tar.gz
View cors_errors.txt
The cors headers in nginx.conf fixes the errors:
# firefox
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS request did not succeed)
# safari
Failed to load resource: Origin is not allowed by Access-Control-Allow-Origin.
Fetch API cannot load https:/ Origin is not allowed by Access-Control-Allow-Origin.
miguelmota /
Last active Aug 9, 2019
Nginx install headers-more-nginx-module (more_set_headers) in Amazon Linux AMI
#!/usr/bin/env bash
cd /usr/local/src
# get nginx source.
miguelmota / webauthn_supported.js
Created Aug 7, 2019
JavaScript check if webauthn api (fido/u2f) is supported in browser
View webauthn_supported.js
const isSupported = () => {
return !(typeof navigator.credentials !== 'object' || typeof navigator.credentials.create !== 'function' || typeof navigator.credentials.get !== 'function')
You can’t perform that action at this time.