Skip to content

Instantly share code, notes, and snippets.

View mlexs's full-sized avatar

Maciej Lenc mlexs

View GitHub Profile
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@myobie
myobie / create_slides.exs
Created April 20, 2017 21:20
Elixir code to generate a json file of all the svg slides in a directory
# curry the write function
write_data = &(File.write!("./assets/slides.json", &1))
Path.wildcard("./assets/slides/*.svg")
|> Enum.sort()
|> Enum.map(&Path.basename/1)
|> Enum.with_index(1)
|> Enum.map(fn {file, index} -> {file, Path.basename(file, ".svg"), index} end)
|> Enum.map(fn {file, name, index} ->
%{
@lopspower
lopspower / README.md
Last active July 11, 2025 21:46
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@joshnuss
joshnuss / mnesia.exs
Last active March 9, 2024 00:32
Elixir example code for accessing mnesia databases
# define a record, first attribute is considered the key
defrecord User, email: "", first: "", last: ""
# encapsulates mnesia calls
defmodule Database do
def create_schema do
create_table User
end
def find(record, id) do
@dankrause
dankrause / _hover_example.py
Last active January 4, 2025 10:21
Example code to use the (unofficial, unsupported, undocumented) hover.com DNS API.
import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/api/login", params=params)