Skip to content

Instantly share code, notes, and snippets.

View moogle19's full-sized avatar
🚲

Kevin moogle19

🚲
View GitHub Profile
From 6108281171db83394a0a814b5f272c5afb9c4f51 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Tue, 22 Sep 2015 15:25:30 +1200
Subject: [PATCH 1/3] pydsdb: Also accept ldb.MessageElement values to dsdb
routines
This shows the correct way to accept a value that may be a list of strings
or a proper ldb.MessageElement.
Andrew Bartlett
@moogle19
moogle19 / gist:ee0dbbb01a438b5d5de0c907128b7c1d
Created September 2, 2016 12:16
Karabiner F19 to Insert
<?xml version="1.0"?>
<root>
<item>
<name>Map F19 to insert</name>
<identifier>private.map_f12_to_insert</identifier>
<autogen>__KeyToKey__ KeyCode::F12, KeyCode::PC_INSERT</autogen>
</item>
</root>
@moogle19
moogle19 / test.js
Created December 18, 2019 14:28
Test
alert("Hello World");
from(
v in Fnord,
select: [:id],
where: v.id in [9026, 9025, 9024, 9021, 9020, 9019],
join: t in fragment("select * from unnest('{9026, 9025, 9024, 9021, 9020, 9019}'::int[]) WITH ORDINALITY t(id, ord)"),
on: t.id == v.id,
order_by: t.ord
) |> Repo.all
@moogle19
moogle19 / bench.ex
Last active October 3, 2022 22:52
Masking benchmark
defmodule Bench do
def orig(payload, mask) do
maskstream = <<mask::32>> |> :binary.bin_to_list() |> Stream.cycle()
payload
|> :binary.bin_to_list()
|> Enum.zip(maskstream)
|> Enum.map(fn {x, y} -> Bitwise.bxor(x, y) end)
|> :binary.list_to_bin()
end