Skip to content

Instantly share code, notes, and snippets.

@thebigtoona
thebigtoona / linked_list.zig
Created July 24, 2023 22:55
singly linked, allocator managed, linked list in zig
const std = @import("std");
/// a linear singly linked list that is managed with an allocator
pub fn LinkedList(comptime T: type) type {
return struct {
const Self = @This();
const Node = struct {
data: T,
next: ?*Node = null,
@thebigtoona
thebigtoona / filter.zig
Last active August 30, 2021 22:47
quick and dirty impls of map and filter for arraylists in zig
const std = @import("std");
const ArrayList = std.ArrayList;
/// Returns the matches to a provided filter fn for an ArrayList, as a new ArrayList
/// of the same type, _without_ transforming the original list.
///
/// _Params_:
/// `T`: item type for `list` -> ArrayList(`T`)
///
/// `list`: ArrayList to filter on
@thebigtoona
thebigtoona / powershell-web-server.ps1
Created July 27, 2020 21:19 — forked from 19WAS85/powershell-web-server.ps1
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@thebigtoona
thebigtoona / npmconfig.sh
Last active October 29, 2018 17:41
Configure NPM for global installs on linux
#!/bin/bash
# Configure NPM for Global Installation
# Tested on Ubuntu Budgie 18.10
if [[ $( ls -a ~ | grep .npm-global ) ]]; then
echo ".npm-global dir already exists, skipping"
else
echo "creating dir for npm installs in $HOME"
mkdir ~/.npm-global # make a dir for installs
fi