Skip to content

Instantly share code, notes, and snippets.

View fire's full-sized avatar

K. S. Ernest (iFire) Lee fire

View GitHub Profile
@l1x
l1x / ntp.erl
Last active March 1, 2023 08:14
NTP client in Erlang
-module(ntp).
-export([get_time/1, get_time/0]).
-define(NTP_PORT, 123). % udp
-define(SERVER_TIMEOUT, 5000). % ms
-define(EPOCH, 2208988800). % offset yr 1900 to unix epoch
ntp_servers() ->
[ "0.europe.pool.ntp.org",
@IanColdwater
IanColdwater / twittermute.txt
Last active October 25, 2025 19:14
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@zeux
zeux / islandize-reuv.cpp
Last active June 25, 2019 05:58
Isolate UV islands and move each island to 0..1 range if possible; this reduces the total UV range of the mesh.
unsigned int follow(std::vector<unsigned int>& ids, unsigned int v)
{
unsigned int nv = v;
while (ids[nv] != nv)
nv = ids[nv];
return ids[v] = nv;
}
size_t islandize(const std::vector<unsigned int>& indices, std::vector<unsigned int>& islands)
@sbernard31
sbernard31 / test.c
Last active March 11, 2023 18:04
UDP load balancer proto using bcc (XDP/Bpf)
#define KBUILD_MODNAME "foo"
#include <uapi/linux/bpf.h>
#include <linux/bpf.h>
#include <linux/icmp.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/udp.h>
@tiran
tiran / 99-pkiuser-pcsc.rules
Created August 22, 2018 10:39
NitroHSM support for Dogtag
/* polkit rule to allow 'pkiuser' to access NitroHSM PCSC interface
*
* file name: /etc/polkit-1/rules.d/99-pkiuser-pcsc.rules
*
* Resources:
* - https://access.redhat.com/blogs/766093/posts/1976313
* - https://raymii.org/s/articles/Get_Started_With_The_Nitrokey_HSM.html
*
* Installation:
* # dnf install opensc pcsc-lite pcsc-tools
@meshula
meshula / 3d-formats.md
Last active September 2, 2025 18:33
3d file formats, last mile vs. interchange
@fire
fire / install-new-machine.ps1
Last active August 17, 2019 22:32
Install script
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/fire/8f72f1983b5559bcca0c5d57d5f6b32c/raw/68d7a3735a63ba4b0ed397f188d2e5c29074cc5d/install-new-machine.ps1
# See http://boxstarter.org/Learn/WebLauncher
Set-WindowsExplorerOptions -EnableShowFileExtensions
cinst clink
# Correct time is important
cinst nettime
# Dependency needed for this
cinst chocolatey
cinst ChocolateyGUI
# Web browser
@Happsson
Happsson / InactiveCodeDetector.cs
Last active September 14, 2023 15:35
A script that lets you find unused scripts in your unity projects.
/*
This tool iterates through all the files in your project and checks for scripts.
It then goes through all the GameObjects in all the scenes in the project, and
checks for scripts that are not present on any GameObjects.
Note that this does not mean that the script is not used, just that it is possible that it isn't.
The script could still be used in many other ways. This tool is just to narrow the search for
unused code.
@cohawk
cohawk / README.md
Last active June 18, 2025 17:14
CockroachDB fork of the postgrex adapter - Elixir Ecto caveats

Over the weekend I spun up a new Elixir :ecto, "2.2.7" project that I was able to get working with CockroachDB and this adapter fork - with some caveats I wanted to share to help others.

  1. Only the root user can create databases This requires you configure the Ecto.Adapters.Postgres username as root or else the mix ecto.create command will always fail. You can go back and change your configured username to something else after the database has been created, or create your database and user permissions using cockroach sql and skip the mix ecto.create command.

  2. Configuring Ecto primary_key ID to be created by CockroachDB By default when configuring your Ecto.Schema using autogenerate: false it appears either CockroachDB, Ecto or the Postrex adapter (I did not investigate this) uses the BIGINT unique_rowid() function as the default value for IDs

@primary_key {:id, :id, autogenerate:
@Xrayez
Xrayez / StateRecorder.gd
Created December 10, 2017 11:03
State recorder using AnimationPlayer in Godot
# This is a prototype of the state recorder that can be used in a replay system
extends AnimationPlayer
var nodes = []
var animations = {}
var properties = ["global_position", "global_rotation"]
func _init():
set_name("state_recorder")