Skip to content

Instantly share code, notes, and snippets.

View evilz's full-sized avatar
🏠
F# F# F#

Vincent B. evilz

🏠
F# F# F#
View GitHub Profile
@evilz
evilz / Typescript.md
Last active July 17, 2023 10:21
Typescript.md

1.Optional Chaining (?.):

Optional chaining allows you to safely access nested properties or methods without worrying about null or undefined values. It short-circuits the evaluation if any intermediate property is null or undefined.

const user = {
  name: 'John',
  address: {
    city: 'New York',
    postalCode: '12345'
  }
@evilz
evilz / glassui.css
Created July 4, 2023 17:17
Glass ui
/* Background styles */
body {
background-image: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100');
background-position: center;
}
/* Glassmorphism card effect */
.card {
backdrop-filter: blur(16px) saturate(180%);
-webkit-backdrop-filter: blur(16px) saturate(180%);
@evilz
evilz / PG_table_Size.sql
Created January 30, 2023 10:16
PG table Size
select current_database() as database,
pg_size_pretty(total_database_size) as total_database_size,
schema_name,
table_name,
pg_size_pretty(total_table_size) as total_table_size,
pg_size_pretty(table_size) as table_size,
pg_size_pretty(index_size) as index_size
from ( select table_name,
table_schema as schema_name,
pg_database_size(current_database()) as total_database_size,
// /*
// Unival Tree
// #1: 5
// 0
// | \
// 0 1
// | \
@evilz
evilz / Elmish-console.fsx
Created February 5, 2022 14:31
Elmish console counter in 30 lines
#r "nuget: Elmish, 3.1.0"
#r "nuget: Terminal.Gui.Elmish, 0.1.8-preview1"
open System
open Elmish
type Model = { Count: int }
type Messages =
| Incr
@evilz
evilz / start.sh
Created January 20, 2022 21:24
Docker-OSX-WSL2G
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e "DISPLAY=${DISPLAY:-:0}" \
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
-e GENERATE_UNIQUE=true \
-e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \
-v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \
-e RAM=8 \
-v "/mnt/c:/mnt/c" \

Gist markdown examples

A collection of Markdown code and tricks that were tested to work in Gist.

This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.

Todo

  • Reformat this whole document and assimilate these:
@evilz
evilz / ProtbufConnection2.fs
Created May 4, 2021 07:12
ProtbufConnection
module ProtbufConnection2 =
let readWriteTimeout = 120000
let writeMessage (clientSocket: ClientWebSocket) (token: Threading.CancellationToken) (req: #IMessage<Request>) =
let sendBuf = Array.zeroCreate (1024 * 1024)
use co =
new Google.Protobuf.CodedOutputStream(sendBuf)
@evilz
evilz / Program.fs
Last active April 2, 2021 08:15
Todo WebAPI in Fsharp
module TodoBasic
open System
open System.Text.Json.Serialization
open System.Threading.Tasks
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Http
open Microsoft.AspNetCore.Routing
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Hosting
@evilz
evilz / .evilz.omp.json
Last active January 18, 2022 19:28
oh my posh theme
{
"final_space": true,
"osc99": false,
"console_title": false,
"console_title_style": "",
"console_title_template": "",
"blocks": [
{
"type": "prompt",
"alignment": "left",