Skip to content

Instantly share code, notes, and snippets.

View nvlled's full-sized avatar

Ronald T. Casili nvlled

  • Philippines
View GitHub Profile
So I was alone in the pool that day, sitting on the couch. Everyone already left. It was around 2:30 in the noon and—
What? No, I'm not the dog in the picture, I'm obviously not a dog, what a dumb thing to say, why would you even ask that. Do I look that ugly? Uncouth or smelly?
As I was saying, I was on the pool that day—
Huh? Is it my dog on the couch? No... it's just a picture I found on the internet. Where? I don't know, I forgot where. Who cares, the picture is just for illustration purposes and besides the point.
What now? You want to know where the picture came from? Why? Just search “dog on couch beside the pool” or something. See, mega-millions of search results, pick any of those for your desktop background.
#!/bin/bash
function usage() {
echo "usage: $0 <path-tree-sitter-c-dir> <destination-dir>"
echo
echo "description:"
echo " Creates tree-sitter template files for zig bindings"
echo " using the files from tree-sitter-c repository."
exit
}
//! This is a tool used to change the indent size.
//!
//! ## Purpose
//! I wrote this tool because:
//! - some projects uses a non-standard indent-size (like 2-space)
//! - a lot of editors autoformat the file on save, hence converts the 2-space to 4-space)
//! - in particular, zls currently doesn't have an option to change indent size
//!
//! The solution: revert the indent size back to 2-space after I'm done editing
//! ```
#!/usr/bin/env -S dotnet run
#:package Shell.NET@0.2.2
#:package System.CommandLine@2.0.0-beta4.22272.1
// This is a tool that recursively list the dependencies of an apt (debian) package.
// Requires at least dotnet v10.0.0.
using Shell.NET;
using System.Text.RegularExpressions;
using static System.Console;
#!/usr/bin/env -S dotnet run
// About: This is tool to create a zip file from a directory.
// If no filename is given, it creates one in the temp directory.
// The --git option can be used to add only files committed with git.
// Example usages:
// $ zip-dir.cs ~/projects/example
// /tmp/tree-sitter-c-3483789584290746392.zip
// $ zip-dir.cs ~/projects/example example.zip
// Changes the first argument of a function type to *anyopaque
// Example:
// AnyOpaquify(fn(*Self, u8) void) will result to fn (*anyopaque, u8) void
pub fn AnyOpaquify(func: anytype) type {
const T = @TypeOf(func);
const info = @typeInfo(T).@"fn";
var P: [info.params.len]type = undefined;
for (info.params, 0..) |p, i| {
P[i] = p.type.?;

Scribble installation instructions for Ubuntu/Debian

This is an installation instruction Scribble: The Racket Documentation Tool

  1. Install dependencies (required for generating PDF files, skip if not needed)
    $ sudo apt-get install texlive-latex-base texlive-science texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra
  2. Install racket

$ sudo apt install racket

// examples:
// makePermissionDescription'oneTwoThree') == 'one two three'
// makePermissionDescription('hasFooBarXYZ') == 'foo bar XYZ'
// makePermissionDescription('isFOOBar') == 'is FOO bar'
// Note: output is meaningful only for inputs that consists only of letters
const splitByUpperCase = keyName => {
const words = [];
let desc = keyName.replace(/^can/, '');
let loops = 4096;
@nvlled
nvlled / add-monitor-resolution.sh
Created May 22, 2019 11:38
Adds a temporary monitor resolution (linux)
#!/bin/bash
# example usage:
# ./add-monitor-resolution.sh VGA-1 1920 1080
# Note: replace VGA-1 with the name of your device
# run `xrandr --list-monitors` to see the name of your device
monitor=$1
width=$2
height=$3
modeline=`cvt $width $height | tail -n1 | cut --complement -d" " -f 1`
@nvlled
nvlled / sfb.json
Created January 11, 2019 10:00
Svenska FolkBibeln 1998
This file has been truncated, but you can view the full file.
{
"XMLBIBLE": {
"$": {
"version": "2.0.1.22",
"p1:noNamespaceSchemaLocation": "zef2005.xsd",
"biblename": "Svenska Folkbibeln (1998)",
"type": "x-bible",
"status": "v",
"revision": "0",
"xmlns:p1": "http://www.w3.org/2001/XMLSchema-instance"