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 / nginx.conf
Created October 28, 2021 16:20
nginx.conf for Jenkins reverse proxy
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
@santosh
santosh / connectionpool.py
Last active August 24, 2021 05:16
Connection pooling with PostgreSQL in Python.
from psycopg2.extras import DictCursor
from psycopg2.pool import SimpleConnectionPool
class Database:
__pool = None
@classmethod
def initialize(cls, **kwargs):
cls.__pool = SimpleConnectionPool(minconn=2,
@santosh
santosh / AsteroidGrid.js
Created August 2, 2021 08:16
Event passing to parent and back.
// requires Vue.js and Bootstrap
Vue.component('asteroid-grid', {
props: ['asteroids', 'header'],
data: function () {
return {
showSummary: true
}
},
computed: {
numAsteroids: function () {
@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;