Skip to content

Instantly share code, notes, and snippets.

View xsaamiir's full-sized avatar
🟡
xoē

sāmīr xsaamiir

🟡
xoē
View GitHub Profile
@xsaamiir
xsaamiir / goroutines_cheatsheet.go
Last active January 17, 2023 01:12
Golang Goroutines cheatsheet
// from the talk https://www.youtube.com/watch?v=PTE4VJIdHPg
// futures
future := make(chan int, 1)
go func() {future <- process() }()
result := <-future
// async await
c := make(chan int, 1)
go func() { c <- process() }() // async
v := <-c // await
@xsaamiir
xsaamiir / actor.kt
Last active January 5, 2021 11:48
KotlinConf 2018 - Kotlin Coroutines in Practice by Roman Elizarov code Code https://youtu.be/a3agLJQ6vt8
const N_WORKERS = 5
class Content
class Location
class Reference {
fun resolveLocation(): Location = TODO()
}
data class LocContent(val location: Location, val content: Content)
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user
@xsaamiir
xsaamiir / fish_shell.md
Created February 15, 2018 10:31 — forked from idleberg/fish_shell.md
Instructions on how to install Fish shell on Mac OS X, including Oh My Fish!. Also includes several useful functions.

Installation

  1. Install fish via Brew
  2. Optionally install Oh My Fish!
  3. Add fish to known shells
  4. Set default shell to fish
brew install fish  
curl -L https://get.oh-my.fish | fish
@xsaamiir
xsaamiir / index.html
Created January 5, 2018 11:07
React: scrollIntoView
<div id="list"></div>
@xsaamiir
xsaamiir / redux.js
Created January 1, 2018 13:50
to help remeber the redux usage pattern
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { createLogger } from 'redux-logger'
const mathReducer = (state = {
result: 1,
lastValues: []
}, action) => {
switch (action.type) {
case "ADD":
state = {
@xsaamiir
xsaamiir / restaurant-menu.json
Last active January 29, 2023 13:51
example of a restaurant's menu in json from https://codebeautify.org/jsonviewer/cb51497a
{
"array":{
"type":"Restaurant Menu",
"restaurant-info":{
"id":"121721",
"sponsored":"0",
"user-favourite":"",
"name":"Nandos Banani",
"address":"Road-11, Banani, Dhaka",
"rating":"0.00",
@xsaamiir
xsaamiir / env variables windows
Last active December 16, 2017 11:32
To edit env variables without admin rights
rundll32 sysdm.cpl,EditEnvironmentVariables
set __COMPAT_LAYER=RunAsInvoker
start appName