Skip to content

Instantly share code, notes, and snippets.

View MiniAppleTheApple's full-sized avatar

MiniApple MiniAppleTheApple

  • Brasil RJ Rio de Janeiro
View GitHub Profile
@lupyuen
lupyuen / zig-targets.log
Created May 24, 2022 07:42
Zig Targets
$ zig targets
{
"arch": [
"arm",
"armeb",
"aarch64",
"aarch64_be",
"aarch64_32",
"arc",
@ambrosiogabe
ambrosiogabe / How "slow" is brute force?.cpp
Last active January 30, 2023 15:28
A bunch of smart YouTube viewers said my algorithm is horribly inefficient since it was O(n) and I could have used a hash reducing it to O(1). Well, it turns out they were right, except somehow they forgot to account for the data set size which is a big impact on how slow the algorithm *actually* is. Whoopsy!
// System Specs
// ============
// These benchmarks were run on an Intel i7-9700k @ 3.6 GHz
//
// How it was run
// ===============
// The correct recipe is at the very end of the list of recipes. Which means this must run
// through the entire list, the worst case scenario. The rest of the recipes are randomized
// to offer some variation, but I don't set the slots where the correct recipe has the correct slots.
// to ensure we don't accidentally exit early.
@PJUllrich
PJUllrich / big-o.md
Last active September 9, 2025 15:54
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@esmaycat
esmaycat / message_components.md
Last active February 11, 2025 16:44
Message components

Message components

This gist shows you how to use message components in discord.py 2.0

This assumes that you know how Object Orientated Programming in Python works, if you don't know what this is then I recommend that you read this guide.

Installing

You'll need to install discord.py from git to use this (if you don't have git then google how to install it for your OS, I can't be bothered to put it in here...), if you already have this then you can skip to the next section. However if you don't please read the below

@utzig
utzig / zig-argv.md
Created October 6, 2018 12:41
zig argv
const std = @import("std");
const warn = std.debug.warn;
const allocator = std.debug.global_allocator;

pub fn main() !void {
    const args = try std.os.argsAlloc(allocator);
    defer std.os.argsFree(allocator, args);

 warn("total args: {}\n", args.len);
@martinos
martinos / monoids.ex
Last active December 5, 2022 00:02
Monoid examples in elixir
defmodule Monoid do
defmacro __using__(_opts) do
quote do
def concat([head|tail]) do
append(head, concat(tail))
end
def concat([]) do
empty
@reborg
reborg / rich-already-answered-that.md
Last active October 17, 2025 18:52
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@alanpeabody
alanpeabody / my_app.ex
Last active February 19, 2025 16:29
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@msikma
msikma / rfc5646-language-tags.js
Created February 26, 2015 13:51
RFC 5646 Language Tags
// List of language tags according to RFC 5646.
// See <http://tools.ietf.org/html/rfc5646> for info on how to parse
// these language tags. Some duplicates have been removed.
var RFC5646_LANGUAGE_TAGS = {
'af': 'Afrikaans',
'af-ZA': 'Afrikaans (South Africa)',
'ar': 'Arabic',
'ar-AE': 'Arabic (U.A.E.)',
'ar-BH': 'Arabic (Bahrain)',
'ar-DZ': 'Arabic (Algeria)',