Skip to content

Instantly share code, notes, and snippets.

View vladfaust's full-sized avatar
🕉️
एकक्षण

Vlad Faust vladfaust

🕉️
एकक्षण
View GitHub Profile
@vladfaust
vladfaust / index.html
Created January 3, 2023 17:49
webgl shader - Gradient wrap
<div id="app"></div>
@vladfaust
vladfaust / build_sqlite3_lib.md
Created August 18, 2020 17:31 — forked from zeljic/build_sqlite3_lib.md
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source (https://www.sqlite.org/download.html)

    For example: source https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2020/sqlite-dll-win64-x64-3310100.zip

  3. Extract both archives to the same directory

Keybase proof

I hereby claim:

  • I am vladfaust on github.
  • I am vladfaust (https://keybase.io/vladfaust) on keybase.
  • I have a public key ASBTXeiRDhVlIn8XzvrnXtS-SULcuuB1-dBfSciL--FviAo

To claim this, I am signing this object:

@vladfaust
vladfaust / self.md
Created October 9, 2019 19:31
Self

Self

  1. Self is contextual. There may be difficulties for understanding when need instance and when type.
def == (other : self(T)) : Bool
  self.id == other.cast(self).id
end
  1. self for type reference, this for instance reference (or vice versa).
---
BasedOnStyle: LLVM
KeepEmptyLinesAtTheStartOfBlocks: false
BinPackArguments: false
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: true
BreakConstructorInitializers: AfterColon
AlignAfterOpenBracket: AlwaysBreak
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ColumnLimit: 100

This gist is intended to give a choice between two Onyx memory models — weak and strong.

The weak model would imply possibility of memory reorderings done by the compiler, which would result in great performance by default, but create issues when doing lock-free programming.

The strong model would be simpler to newcomers, but slower, requiring to write more code to make it faster.

Note that in all examples above, async means executing in another thread, as soon as possible.

Please see the introduction to memory ordering,

root@dokku2:~# dokku report crystaljobs
-----> uname: Linux dokku2 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
total used free shared buff/cache available
Mem: 988 474 142 21 371 262
Swap: 4095 273 3822
-----> docker version:
Client:
Version: 18.09.2
API version: 1.39
@vladfaust
vladfaust / crystal-sum-smart.cr
Created May 3, 2019 17:44
Sorbet is cool, but polished Crystal is better
class A
def sum(a, b)
a + b
end
end
A.new.sum("foo", 42) # Compilation-time error, `String` cannot be summed with `Int`
@vladfaust
vladfaust / crystal-sum.cr
Created May 3, 2019 17:43
Sorbet is cool, but polished Crystal is better
class A
def sum(a : Int, b : Int) : Int
a + b
end
end
A.new.sum("foo", 42) # Compilation-time error, `a` is not Int32
@vladfaust
vladfaust / crystal-hello.cr
Created May 3, 2019 17:43
Sorbet is cool, but polished Crystal is better
def hello(who)
puts "Hello, #{who}!"
end
hello("world") # puts "Hello, world!"