Skip to content

Instantly share code, notes, and snippets.

@synaptic-cleft
synaptic-cleft / wordcount.go
Created December 17, 2021 20:04
Word count in Go
package main
import (
"fmt"
"os"
"bufio"
"strings"
)
func main() {
@synaptic-cleft
synaptic-cleft / eea.go
Created December 17, 2021 18:42
Extended Euclidean Algorithm in Go
package main
import "fmt"
import "os"
import "strconv"
// extended euclidean algorithm
// Example: `go run eea.go 35 15`
func main() {
if len(os.Args) != 3 {
@synaptic-cleft
synaptic-cleft / server.js
Created March 2, 2020 13:17
CORS workaround in stub server for axios calls with Authorization header for access token
const express = require('express')
const app = express()
// !!! This is a workaround for local development only. NEVER DO THIS ON PRODUCTION !!! SOC would kill you. And your family.
let allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost:5000')
res.header('Access-Control-Allow-Headers', 'Authorization')
res.header('Access-Control-Allow-Credentials', 'true')
next()