Skip to content

Instantly share code, notes, and snippets.

View vic's full-sized avatar
🤮
puke nuke

Victor Borja vic

🤮
puke nuke
View GitHub Profile
@vic
vic / 2023-12-03.zig
Created December 5, 2023 18:57
AdventOfCode 2023 Day03 in Zig
const std = @import("std");
const Allocator = std.mem.Allocator;
const ConstantInput = *const []const u8;
const NumIdx = struct {
fromIdx: usize,
toIdx: usize,
pub fn text(self: NumIdx, input: ConstantInput) []const u8 {
@vic
vic / jitpack.yml
Created August 8, 2023 09:50
scala-cli gh-actions
before_install:
- curl -o scala-cli https://raw.githubusercontent.com/VirtusLab/scala-cli/main/scala-cli.sh
- chmod +x scala-cli
install:
- |
./scala-cli --power publish --publish-repository $HOME/.m2/repository --organization "$GROUP" --name "$ARTIFACT" --version "$VERSION" .
ls -R $HOME/.m2/repository/
find $HOME/.m2/repository -type f -name "*.pom" -exec cp -v {} $PWD \;
// ==UserScript==
// @name Gmail w/ Collapsible & Minimalist Inbox plus Google Calendar, Reader, Notebook, etc... Seamless Integration
// @namespace mail.google.com
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// ==/UserScript==
var USER_CONFIGURATION =
{
ELEMENTS: //Place in order the pages you would like to load. Placing mail in the list will may it collapsible. Other choices are: reader, calendar, notebook or groups (must be lowercase.)
import mill._
trait BuildrModule extends Module {
def logger = {
val colors = interp.colors()
new mill.util.PrintLogger(
colors != ammonite.util.Colors.BlackWhite,
false,
colors.info(),
import com.raquo.airstream.flatten.FlattenStrategy
import com.raquo.laminar.api.L._
import com.raquo.laminar.nodes.ReactiveElement
import com.raquo.laminar.nodes.ReactiveHtmlElement
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import org.scalajs.dom
@vic
vic / SlothMux.sc
Created December 9, 2021 23:54
An Scala RPC API using Sloth (with binary Boopickle serialization) and Twitter Finagle Mux as transport.
/**
* Usage:
*
* ammonite SlothMux.sc runServer
*
* ammonite SlothMux.sc runClient
*/
import $ivy.`io.catbird::catbird-finagle:21.8.0`
import $ivy.`com.twitter::finagle-mux:21.8.0`
@vic
vic / cat
Last active April 30, 2021 03:26
Create an exhibition with bits, due on Thu, Jul 20, 2017 $ cat /bin/cat | xxd --bits
0000000: 11001111 11111010 11101101 11111110 00000111 00000000 ......
0000006: 00000000 00000001 00000011 00000000 00000000 10000000 ......
000000c: 00000010 00000000 00000000 00000000 00010000 00000000 ......
0000012: 00000000 00000000 01010000 00000110 00000000 00000000 ..P...
0000018: 10000101 00000000 00100000 00000000 00000000 00000000 .. ...
000001e: 00000000 00000000 00011001 00000000 00000000 00000000 ......
0000024: 01001000 00000000 00000000 00000000 01011111 01011111 H...__
000002a: 01010000 01000001 01000111 01000101 01011010 01000101 PAGEZE
0000030: 01010010 01001111 00000000 00000000 00000000 00000000 RO....
0000036: 00000000 00000000 00000000 00000000 00000000 00000000 ......
@vic
vic / gist:1f2dc6201cbe55b358c9c29f2af39851
Created July 1, 2020 20:08
Mill not generating sourcemaps when using scalajs >= 1.
❯ ./mill scalajslib.test 'mill.scalajslib.HelloJSWorldTests.fastOpt'
[94/356] scalajslib.worker[1].compile
[info] Compiling 1 Scala source to /h/mill/out/scalajslib/worker/1/compile/dest/classes ...
[warn] 1 deprecation (since 2.13.0); re-run with -deprecation for details
[warn] one warning found
[info] Done compiling.
[221/356] main.core.compile
[info] Compiling 1 Scala source to /h/mill/out/main/core/compile/dest/classes ...
[info] Done compiling.
[356/356] scalajslib.test.test

Keybase proof

I hereby claim:

  • I am vic on github.
  • I am oeiuwq (https://keybase.io/oeiuwq) on keybase.
  • I have a public key ASDl3QUhn_Iv58GAMXdWpgBTMfK7AB_NVO7Kfd37fv2zPgo

To claim this, I am signing this object:

DROP FUNCTION IF EXISTS levenshtein;
DELIMITER $$
CREATE FUNCTION `levenshtein`( s1 text, s2 text) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT;
DECLARE s1_char CHAR;
DECLARE cv0, cv1 text;
SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0;
IF s1 = s2 THEN