Skip to content

Instantly share code, notes, and snippets.

View matu3ba's full-sized avatar

Jan Ph. H. matu3ba

View GitHub Profile
@lithdew
lithdew / x.md
Last active May 20, 2021 09:20
zig: `std.x` wishlist
  • Include std.x.os.Reactor.

A high-level I/O event reactor interface that wraps over event notification systems like epoll, kqueue.

Plan is to get epoll done first, kqueue second, select third, then iocp/afd fourth.

  • Include std.x.os.Socket.setLinger(linger_for_num_seconds: ?u16) !void.
  • Include std.x.os.Socket.getRemoteAddress() !std.x.Socket.Address.
  • Include std.x.os.Socket.setKeepAlive(enabled bool) !void.
  • Include std.x.os.Socket.(r|R)eader(flags) and std.x.os.Socket.(w|W)riter(flags).
@mitchellh
mitchellh / json.zig
Last active April 5, 2023 21:04
Streaming JSON decoder for Zig (NOT COMPLETE!)
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const StreamingParser = std.json.StreamingParser;
const Token = std.json.Token;
const TokenTag = std.meta.FieldEnum(Token);
/// Field options are options that can be set per-field on a struct at
@marcora
marcora / gist:cb37b2432c072e8e9d77
Created September 15, 2015 03:24
Install Adobe Source Code Pro font on Linux
#!/bin/sh
echo "installing fonts at $PWD to ~/.fonts/"
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
# find ~/.fonts/ -iname '*.ttf' -exec echo \{\} \;
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro
echo "finished installing"
@lobre
lobre / zig_type_system.md
Last active March 15, 2024 20:43
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@alan-null
alan-null / msbuild.ps1
Last active April 11, 2024 02:14 — forked from kamsar/msbuild.ps1
PowerShell to resolve MSBuild.exe on VS2017 or VS2015 (or with Build Tools 2015)
function Resolve-MsBuild {
$msb2017 = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\*\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2017) {
Write-Host "Found MSBuild 2017 (or later)."
Write-Host $msb2017
return $msb2017 | Select-Object -First 1
}
$msBuild2015 = "${env:ProgramFiles(x86)}\MSBuild\14.0\bin\msbuild.exe"
@kamsar
kamsar / msbuild.ps1
Last active April 11, 2024 02:14
PowerShell to resolve MSBuild.exe on VS2017 or VS2015 (or with Build Tools 2015)
function Resolve-MsBuild {
$msb2017 = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\*\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2017) {
Write-Host "Found MSBuild 2017 (or later)."
Write-Host $msb2017
return $msb2017
}
$msBuild2015 = "${env:ProgramFiles(x86)}\MSBuild\14.0\bin\msbuild.exe"
@sdondley
sdondley / tmux split-window subcommand.md
Last active April 23, 2024 11:49
Super Guide to the split-window tmux Subcommand (and Beyond)

Super Guide to the split-window tmux Subcommand (and Beyond)

Guide overview

tmux, like other great software, is deceptive. On the one hand, it's fairly easy to get set up and start using right away. On the other hand, it's difficult to take advantage of tmux's adanced power features without spending some quality alone time with the manual. But the problem with manuals is that they aren't geared toward beginners. They are geared toward helping seasoned developers and computer enthusiasts quickly obtain the