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
// Given the string `input`, replaces every instance of `#include "file"` with the contents | |
// of `file` (relative to `include_dir`). The returned string aliases `input` if no includes were found, | |
// otherwise it's a new copy with the same lifetime as `arena`. | |
String8 file_resolve_includes(Arena *arena, String8 input, String8 include_dir) | |
{ | |
String8 output = {}; | |
String8 include_str = str8("#include"); | |
Temp scratch = scratch_begin(&arena, 1); |
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
// @author silverweed | |
// Finds all svg files under the current directory and appends a newline to them if they don't end with a newline already. | |
#define WINDOWS_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <stdio.h> | |
#include <strsafe.h> | |
BOOL verbose = 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
use std::borrow::Cow; | |
type NumType = u128; | |
fn read_num_from_args() -> Result<NumType, Cow<'static, str>> { | |
let mut args = std::env::args(); | |
let program_name = args.next().unwrap(); | |
let num = if let Some(num) = args.next() { | |
if let Ok(num) = u128::from_str_radix(&num, 10) { |
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/bash | |
# parallel port check via nc. Takes ~1 s per scanned service, but | |
# should almost not depend on the number of hosts. | |
# by silverweed | |
# FIXME: echo-ing lines from check_host may result in more lines | |
#+ bloated together. | |
# file containing the IPs to scan | |
HOSTLIST="$HOME/.hostlist.txt" | |
NC="/bin/nc" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#pragma once | |
#include <cstdlib> | |
#include <cstdio> | |
#include <cstdint> | |
#include <cassert> | |
#include <utility> | |
#define ABORT(x) do { \ | |
fprintf(stderr, "%s\n", x); \ |
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/bash | |
HARDLIMIT=120 | |
FOUND=$(find src/ -not -path \*third\* -type f -name \*pp -exec awk -v HL=$HARDLIMIT ' | |
length($0) > HL { | |
printf "%s:%d %s", FILENAME, FNR, $0 | |
}' {} +) | |
if [[ -n $FOUND ]]; then | |
echo "Following lines are longer than hardlimit $HARDLIMIT:" | |
while read LINE; do echo $LINE; done < <(echo -e $FOUND) |
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
import std.stdio; | |
import derelict.sfml2.system; | |
import derelict.sfml2.window; | |
import derelict.opengl3.gl3; | |
bool running = true; | |
void main() { | |
// Load shared C libraries | |
DerelictGL3.load(); |
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
CC = nvcc | |
CFLAGS = -std=c++11 --compiler-options -Wall --compiler-options -Wextra --compiler-options -ggdb | |
LDFLAGS = -lsfml-graphics -lsfml-window -lsfml-system -lcurand | |
all: test2 | |
%: %.o | |
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | |
%.o: %.cu myutils.hpp |
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
-- @author silverweed, 2016 | |
-- @license WTFPL | |
import System.Environment | |
import System.IO | |
import Data.List | |
showIndents input = header ++ (mkList input) ++ "\n" | |
where | |
header = "indent: occurrences\n" | |
mkList = intercalate "\n" . map (\(o,i) -> (show i) ++ ": " ++ (show o)) . |
NewerOlder