This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=WSL-Interop Access Control | |
[Path] | |
PathChanged=/run/WSL | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
Help() | |
{ | |
cat <<-EOF | |
Usage: $0 NUMBER[SUFFIX]... | |
or: $0 OPTION | |
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), | |
'm' for minutes, 'h' for hours or 'd' for days. NUMBER need not be an |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.21) | |
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) | |
set(CMAKE_CUDA_ARCHITECTURES "75") | |
endif() | |
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc") | |
project(example-app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
annotation ParserAttr | |
end | |
annotation TopSymbolAttr | |
end | |
annotation SymbolAttr | |
end | |
annotation Rule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# channel.cr | |
class Channel(T) | |
struct Sender(T) | |
@link : Crystal::StaticList | |
end | |
Crystal::StaticList.container_of(ptr, Channel::Sender(T), @link) | |
end | |
# crystal/static_list.cr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Machine | |
enum State | |
Before | |
Run | |
After | |
Next | |
end | |
def initialize(@state : State, @line : Int32) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def new_rotate!(n = 1) | |
return self if empty? | |
sz = @size | |
n %= sz | |
return self if n == 0 | |
st = to_unsafe | |
ed = st + sz | |
while (sz > 1 && n != 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
class Array | |
def new_rotate!(n = 1) | |
return self if empty? | |
sz = self.size | |
n %= sz | |
return self if n == 0 | |
tmp = Slice.new(to_unsafe, sz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro container_of(ptr, _type, member) | |
{% if _type.resolve < Reference %} | |
(({{ ptr }}).as(Void*) - offsetof({{ _type }}, {{ member }})).as({{ _type }}) | |
{% else %} | |
(({{ ptr }}).as(Void*) - offsetof({{ _type }}, {{ member }})).as(Pointer({{ _type }})) | |
{% end %} | |
end | |
struct StaticList | |
@prev = uninitialized Pointer(StaticList) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ch = Channel(Int32).new | |
done = Channel(Time::Span).new | |
count = (ARGV[0]? || 1000).to_i | |
4.times do | |
spawn do | |
delay = Time::Span::ZERO | |
count.times do |i| |
NewerOlder