Skip to content

Instantly share code, notes, and snippets.

View txdv's full-sized avatar

Andrius Bentkus txdv

View GitHub Profile
@txdv
txdv / Puzzle06.scala
Created December 6, 2022 08:28
aoc 2022 puzzle06
import Converters._
object Puzzle06 extends Runnable {
def find(line: String, count: Int): Int = {
val result = line.sliding(count).zipWithIndex.find { case (e, i) =>
e.toSet.size == count
} getOrElse {
???
}
@txdv
txdv / Makefile
Last active March 12, 2021 08:58 — forked from IridescentRose/uuid.zig
A simple UUID v4 Generator
uuid: main.zig
zig build-exe --strip --single-threaded main.zig
mv main uuid
run: uuid
./uuid
using System;
public static class Main
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
@txdv
txdv / Main.cs
Created April 3, 2017 08:23
Hello World
public class Main
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
@txdv
txdv / exceptions.cs
Last active February 15, 2017 18:14
Can not yield from finally block
using System;
using System.Collections.Generic;
public class MainClass
{
public static IEnumerable<string> Actions()
{
try {
yield return "try";
} catch (Exception) {
@txdv
txdv / Makefile
Last active November 16, 2016 07:15
Example
main.exe: main.cs
mcs /unsafe main.cs
@txdv
txdv / pipe_with_atime.c
Created November 10, 2016 07:23 — forked from JackDrogon/pipe_with_atime.c
pipe atime benckmark
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/unistd.h>
@txdv
txdv / nf.c
Created September 21, 2016 05:55 — forked from Taehun/nf.c
Linux Kernel Module Example: Netfilter
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter_ipv4.h>
#include <linux/skbuff.h>
#include <linux/udp.h>
#include <linux/ip.h>
/* This function to be called by hook. */
static unsigned int
hook_func(unsigned int hooknum,
@txdv
txdv / Makefile
Last active March 23, 2016 01:27 — forked from mhanne/Makefile
libotr usage example
all: example
example: example.c
gcc example.c -lotr -o example
.PHONY: clean
clean:
rm -f example
@txdv
txdv / bridge.diff
Last active August 29, 2015 14:27 — forked from anonymous/-
diff --git a/Bridge/Resources/bridge.js b/Bridge/Resources/bridge.js
index 3d92710..0da0eb1 100755
--- a/Bridge/Resources/bridge.js
+++ b/Bridge/Resources/bridge.js
@@ -1,4 +1,4 @@
-/*
+/*
* @version : 1.8.0 - Bridge.NET
* @author : Object.NET, Inc. http://bridge.net/
* @date : 2015-08-17