Skip to content

Instantly share code, notes, and snippets.

View samhattangady's full-sized avatar

Samarth Hattangady samhattangady

View GitHub Profile
@samhattangady
samhattangady / batch_scripts.md
Created October 15, 2023 15:15
Some helpful batch scripts

Just a note of some of the batch scripts I have for various purposes

timecmd

Similar to time on linux. Used to measure how long a command takes to run. Source: https://stackoverflow.com/a/6209392/5453127

@echo off
@setlocal

set start=%time%
@samhattangady
samhattangady / build.zig
Created September 14, 2023 04:04
build.zig for a game released on steam
const Builder = @import("std").build.Builder;
const std = @import("std");
// TODO (20 Jun 2021 sam): -Drelease-fast=true gives rise to a lld-link: error: undefined symbol: _tls_index
pub fn build(b: *Builder) void {
var load_libs = true;
var font_size: f32 = 26.0;
var web_build = false;
var testing = false;
var stbi_include = false;
@samhattangady
samhattangady / gather.zig
Created May 24, 2022 15:54
zig script to gather data into json.
// gather is a script that runs to collect all the data into one single file
// we want to create a single json file where all the contents are dumped in
// as strings, with the object key being the filepath.
const std = @import("std");
const JSON_SERIALIZER_MAX_DEPTH = 32;
pub const JsonWriter = std.io.Writer(*JsonStream, JsonStreamError, JsonStream.write);
pub const JsonStreamError = error{JsonWriteError};
pub const JsonSerializer = std.json.WriteStream(JsonWriter, JSON_SERIALIZER_MAX_DEPTH);
pub const JsonStream = struct {
@samhattangady
samhattangady / soln_6.vasm
Created October 9, 2020 14:27
Hovalaag Bug?
; The documentation in sample.vasm states that "F=POS(A>>1) is true if and only if A was positive and even before the shift"
; This doesn't seem to be the case in v1.08. Even a negative even number seems to give a true value.
; Solution for problem 6.
get_input:
A=IN1, C=0, B=1
D=A
loop:
F=ZERO(-A)
@samhattangady
samhattangady / readme.txt
Created August 31, 2020 03:58
Mouse in Slippers (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@samhattangady
samhattangady / readme.txt
Created August 31, 2020 03:42
Mouse in Slippers (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@samhattangady
samhattangady / readme.txt
Created August 30, 2020 20:22
Mouse in Slippers (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@samhattangady
samhattangady / tms2xyz.py
Created January 31, 2019 12:05
Converting tiles from TMS to XYZ format
"""
Script to convert all tiles from TMS format to XYZ format.
gdal2tiles.py creates tiles in TMS format by default. XYZ
is a little easier to consume.
This script expects a root directory, and a zoom level.
"""
import os
import sys
@samhattangady
samhattangady / geoserver_unadvertise.py
Last active September 27, 2018 05:29
A quick script to unadvertise all the layers on a geoserver to by setting advertised to false using the geoservers REST APIs.
'''
By default, all the layers in any geoserver are advertised. This means
that anyone with the link to the geoserver can view all the available
layers.
This is not an ideal situation. In case you already have a lot of layers
already uploaded onto the geoserver, it is cumbersome to manually go to
each layer an uncheck the `advertised` checkbox.
So a quick script can do that for you.