Skip to content

Instantly share code, notes, and snippets.

View SuperCipher's full-sized avatar
💭
GMT+7 08:00 - 22:00

Napat SuperCipher

💭
GMT+7 08:00 - 22:00
  • Thailand
View GitHub Profile
@SuperCipher
SuperCipher / gist:be50793e1b6cd9dabb52ac27099c2d1e
Created April 26, 2022 11:37
get all container name and ip
https://stackoverflow.com/a/63023383/3422861
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} %tab% {{.Name}}' $(docker ps -aq
) | sed 's#%tab%#\t#g' | sed 's#/##g' | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
@SuperCipher
SuperCipher / Main.purs
Created May 2, 2022 17:29
4 different way to update record in purescript
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
type Person = Age (name :: String)
type Age a =
@SuperCipher
SuperCipher / toNonZeroInteger
Created May 3, 2022 09:21
function to create a set of non zero interger number useful for sanitize input
toNonZeroInteger :: Int -> Int
toNonZeroInteger 0 = 1
toNonZeroInteger x = if x < 0
then (-x) + 1
else x + 1
@SuperCipher
SuperCipher / type compatibility table.txt
Created December 19, 2022 02:55
type compatibility table
https://github.com/microsoft/TypeScript/issues/26262#issuecomment-431406596
function createPromises(onFunctions) {
return onFunctions.map(onFunction => {
return new Promise((resolve, reject) => {
try {
onFunction(resolve)
} catch (e) {
reject(new Error(`Error in function ${onFunction.name}: ${e}`))
}
})
})