Skip to content

Instantly share code, notes, and snippets.

View santosh's full-sized avatar
:octocat:

Santosh Kumar santosh

:octocat:
View GitHub Profile
@santosh
santosh / vue.html
Created August 2, 2021 07:38
Fetching API, handing events, doing CSS animations.
<!DOCTYPE html>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<style>
[v-clock] {
display: none;
}
.highlight {
border: solid 3px red;
color: 'red'
@santosh
santosh / vue.html
Created August 2, 2021 07:36
Props and slots. Slot scopes.
<!DOCTYPE html>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<style>
[v-cloak] {
display: none;
}
</style>
<div id="app">
@santosh
santosh / vue.html
Created August 2, 2021 06:47
Fetching API, handing events, doing CSS animations.
<!DOCTYPE html>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<style>
[v-clock] {
display: none;
}
.highlight {
border: solid 3px red;
color: 'red'
@santosh
santosh / main.go
Created June 17, 2021 12:31
Multiplexing concurrency pattern
package main
import (
"fmt"
"math/rand"
"time"
)
func boring(msg string) <-chan string { // Returns receive-only channel of strings.
c := make(chan string)
@santosh
santosh / main.go
Created June 17, 2021 12:19
Generator concurrency pattern.
package main
import (
"fmt"
"math/rand"
"time"
)
func boring(msg string) <-chan string { // Returns receive-only channel of strings.
c := make(chan string)
@santosh
santosh / main.go
Last active June 17, 2021 11:41
progressively learning goroutines
package main
import (
"fmt"
"math/rand"
"time"
)
func boring(msg string, c chan string) {
for i := 0; ; i++ {
@santosh
santosh / index1.html
Created April 16, 2021 05:47
CSS Grid for beginners.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Grid</title>
<style>
.container {
display: grid;

Authenticate A Golang API With JSON Web Tokens

JSON Web Tokens refresher

The client sends login credentials, the server checks matches the credentials

@santosh
santosh / find_command.md
Last active September 19, 2020 03:22
Useful find command.

Note this command.

find . -not -path '*/\.*' -iname '*' -maxdepth 1 -mtime -1

Let's cut it open and see what's happening.

  1. find .: This says find in the current directory (. is cwd).
  2. -not -path '*/\.*': This says not to match dot (hidden) files.
  3. -iname '*': This says match * (any name). The i in iname is for case-insensitive.
  4. -mtime -1: This says only match files which are modified less than 1 day(s) ago. If - is turned to +, it will say only match files which are not modified after one day which is same as matching every file which are modified after one day.
@santosh
santosh / copy-from-bucket-to-bucket.go
Last active September 11, 2020 07:43
Some fiddling with AWS Go's SDK. Experiments done with S3.
package main
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)