Skip to content

Instantly share code, notes, and snippets.

View L04DB4L4NC3R's full-sized avatar
😏
Noob is just a state of mind

Angad Sharma L04DB4L4NC3R

😏
Noob is just a state of mind
View GitHub Profile
@L04DB4L4NC3R
L04DB4L4NC3R / errors.go
Created December 26, 2019 22:35
Clean arch
package errors
import (
"errors"
)
var (
ErrNotFound = errors.New("Error: Document not found")
ErrNoContent = errors.New("Error: Document not found")
ErrInvalidSlug = errors.New("Error: Invalid slug")
@L04DB4L4NC3R
L04DB4L4NC3R / errors.go
Created December 26, 2019 22:37
Clean Architecture
package views
import (
"encoding/json"
"errors"
"net/http"
log "github.com/sirupsen/logrus"
pkg "github.com/L04DB4L4NC3R/jobs-mhrd/pkg"
@L04DB4L4NC3R
L04DB4L4NC3R / gist:9cc03bc3307d20297dbdcb47dd4ab4d3
Created January 10, 2020 21:57
FormData in fetch. [Not solved yet, KMN]
https://muffinman.io/uploading-files-using-fetch-multipart-form-data/
@L04DB4L4NC3R
L04DB4L4NC3R / herokuconfig.sh
Created January 11, 2020 17:08
Heroku config script
#!/bin/bash
while p= read -r line; do
heroku config:set $line
done < ./.env
@L04DB4L4NC3R
L04DB4L4NC3R / fix.sh
Created January 11, 2020 22:56
HEROKU H10 series errors
# Logs weren't giving me any clues.
# So I scaled down and scaled back up the dynos.
#This solved the problem for me:
heroku ps:scale web=0
# Waited a few seconds...
sleep(4)
heroku ps:scale web=1
@L04DB4L4NC3R
L04DB4L4NC3R / .env
Last active January 15, 2020 18:34
GitHub repo creation script (from template)
GITHUB_PERSONAL_ACCESS_TOKEN=
GITHUB_TEMPLATE_NAME=
GITHUB_TEMPLATE_OWNER=
GITHUB_ORGANIZATION_OWNER=
@L04DB4L4NC3R
L04DB4L4NC3R / index.html
Last active January 15, 2020 23:17
wasm doubt
<script>
(async () => {
const bytes = await fetch("target/wasm32-unknown-unknown/debug/car_fib.wasm")
const response = await bytes.arrayBuffer()
const result = await WebAssembly.instantiate(response, {})
console.log(result.instance.exports.add(10, 3))
})()
</script>
@L04DB4L4NC3R
L04DB4L4NC3R / export_csv.sh
Last active January 25, 2020 15:26
Heroku pg (postgresql) csv export
timestamp=`date | sed 's/\s/_/g'`
filename=technoscape_abstract_form_details_${timestamp}
heroku pg:psql -a hidden-hollows-55794 --command "\copy (select * from main_uploader) to $filename.csv csv delimiter ' ';"
@L04DB4L4NC3R
L04DB4L4NC3R / connecting_to_wifi.sh
Last active February 23, 2020 12:07
Sys scripts
nmcli dev wifi
nmcli dev wifi connect $ESSID password $WIFI_PASSWORD