Mix.install([
{:nimble_parsec, "~> 1.0"}
])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule CeasarCipher do | |
@lower Enum.to_list(?a..?z) | |
@upper Enum.to_list(?A..?Z) | |
defp map_within_range(c, range, shift) do | |
if c in range do | |
range | |
|> Stream.cycle() | |
|> Stream.drop(shift + (c - hd(range))) | |
|> Stream.take(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1..100_000 | |
|> Task.async_stream(&do_something/1) | |
|> Stream.map(fn {:ok, v} -> v end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nix-shell | |
#!nix-shell -i ruby -p ruby rubyPackages.rmagick | |
require "rmagick" | |
include Magick | |
colors = { | |
{r: 32, g: 48, b: 120} => [0, {r: 0, g: 0, b: 0}], | |
{r: 32, g: 64, b: 168} => [1, {r: 17, g: 17, b: 17}], | |
{r: 48, g: 104, b: 200} => [2, {r: 34, g: 34, b: 34}], | |
{r: 56, g: 128, b: 216} => [3, {r: 51, g: 51, b: 51}], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo pacman -S openssl-1.0 | |
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang | |
mkdir ~/.openssl-1.0 | |
cd ~/.openssl-1.0 | |
ln -s /usr/include/openssl-1.0 include | |
ln -s /usr/lib/openssl-1.0 lib | |
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
__choice=$(printf '%s\n' Work Personal | wofi -dmenu -p "Select project scope" -L 2) | |
__work_projects=~/projects/work | |
__personal_projects=~/projects/personal | |
show_options() { | |
case $1 in | |
'Open with Emacs') emacs $2;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DoubleCola do | |
defp mapper({current_names, size}), | |
do: Enum.map(current_names, &(%{name: &1, size: size})) | |
defp traverse([%{name: name, size: size} | rest], n) when n <= size, | |
do: name | |
defp traverse([%{name: name, size: size} | rest], n), | |
do: traverse(rest, n - size) | |
def find_nth(names, n) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Result<T> = {type: "ok", data: T} | {type: "error", reason: string}; | |
export const ok = <T = unknown>(data: T): Result<T> => { | |
return {type: "ok", data }; | |
}; | |
export const error = <T = unknown>(reason: string): Result<T> => { | |
return {type: "error", reason}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Instructions | |
# Before running this: | |
# - Delete your ~/.local/share/Steam/steamapps/compatdata/$GAME_ID folder. | |
# - Then set your proton version to 5.0-10 for the game. | |
# - Run the game and close after it starts. | |
# - After that, you're good to go. | |
# If the game is Rockman X Legacy Collection 1, the ID should be 743890 | |
# If the game is Rockman X Legacy Collection 2, the ID should be 743900 | |
# Thanks to https://github.com/PedroHLC for Debbuging this thing and finding out how to solve. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bigdecimal' | |
@percentages = [ | |
BigDecimal("0.99"), | |
BigDecimal("0.98"), | |
BigDecimal("0.97"), | |
BigDecimal("0.96"), | |
BigDecimal("0.95"), | |
BigDecimal("0.94"), | |
BigDecimal("0.93"), |
NewerOlder