This file contains hidden or 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
| //! Leaking hash map | |
| //! | |
| const std = @import("std"); | |
| const assert = std.debug.assert; | |
| const print = std.debug.print; | |
| const Allocator = std.mem.Allocator; | |
| const Stack = @This(); |
This file contains hidden or 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
| --- SPDX-License-Identifier: MIT | |
| ---Convert buffer in window to HTML, and open it in default browser. | |
| ---`winid` and `opt` are passed directly to `tohtml.tohtml` | |
| ---@param winid? integer # Window to convert (defaults to current window). | |
| ---@param opt? vim.tohtml.opt # Optional parameters. | |
| function OpenHtml(winid, opt) | |
| -- Make sure `tohtml.tohtml` is available | |
| if vim.fn.has("nvim-0.10.0") == 0 then | |
| print("`tohtml` function is only available after NeoVim 0.10") |
This file contains hidden or 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
| # Automatically start tmux for ssh connections | |
| # This will _unconditionally_ run tmux. If tmux may not be available (e.g. you use the same .bashrc | |
| # for multiple systems), you can wrap it in an if statement: | |
| # | |
| # if command -v tmux >/dev/null 2>&1; then | |
| # ... | |
| # fi | |
| # is interactive, is not in tmux, is in ssh |
This file contains hidden or 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
| const std = @import("std"); | |
| // Although this function looks imperative, note that its job is to | |
| // declaratively construct a build graph that will be executed by an external | |
| // runner. | |
| pub fn build(b: *std.Build) void { | |
| const target = b.standardTargetOptions(.{}); | |
| const optimize = b.standardOptimizeOption(.{}); | |
| const translate_c = b.addTranslateC(.{ |
This file contains hidden or 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
| param ( | |
| # Folder to search recursively for fonts to install | |
| [string]$Folder = "$Env:USERPROFILE\Fonts\Ensure Installed", | |
| # Array of glob patterns to match | |
| [string[]]$Types = ("*.fon", "*.otf", "*.ttc", "*.ttf") | |
| ) | |
| # Go through all folders in source and list all files | |
| if (Test-Path -Path $Folder -Type Container) { | |
| $fontList = Get-ChildItem ` |
This file contains hidden or 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
| # Exit if non-interactive | |
| [[ -z "$PS1" ]] && return | |
| _colors=false | |
| if [[ -x /usr/bin/tput ]] && tput setaf 1 >&/dev/null; then | |
| # tput is executable, and it doesn't fail when trying to set the foreground color | |
| _colors=true | |
| else | |
| case "$TERM" in |
This file contains hidden or 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
| # Make sure that the `/etc/netplan` folder is not accessable by users other than root | |
| # e.g. `chmod 660 -R /etc/netplan` | |
| network: | |
| version: 2 | |
| renderer: NetworkManager # You can also use `networkd` | |
| ethernets: | |
| enp0s3: # It is possible that you will need to change this. Run `ip address show` to list your network interfaces | |
| dhcp4: no | |
| addresses: [192.168.0.100/24] # Set your own static IP(s) here (using CIDR notation) |
This file contains hidden or 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
| use std::io; | |
| use ndarray::{self, arr2, Array2, Array1}; | |
| fn main() { | |
| let cell_empty: char = '-'; | |
| let stdin = io::stdin(); | |
| let mut grid = arr2(&[ | |
| [cell_empty, cell_empty, cell_empty], | |
| [cell_empty, cell_empty, cell_empty], |