Skip to content

Instantly share code, notes, and snippets.

View focused's full-sized avatar

Dmitry Novikov focused

  • Batumi, Georgia
View GitHub Profile

How to install game-porting-toolkit (aka proton for macOS)

You also might wanna just use Whisky which does this automatically

This guide works on macOS 13.4+ using Command Line Tools for XCode 15 Beta!

What is this?

In the recent WWDC, Apple announced and released the "game porting toolkit", which upon further inspection this is just a modified version of CrossOver's fork of wine which is a "compatibility layer" that allows you to run Windows applications on macOS and Linux.

@juanpabloaj
juanpabloaj / logs_with_color.exs
Created June 25, 2021 23:41
elixir, colorful log lines
require Logger
Logger.configure_backend(:console, format: "$time $metadata[$level] $levelpad$message\n")
# more colores in
# https://hexdocs.pm/elixir/1.12/IO.ANSI.html
Logger.info("colorful log line", ansi_color: :black)
Logger.info("colorful log line", ansi_color: :blue)
Logger.info("colorful log line", ansi_color: :cyan)
@smaximov
smaximov / README.md
Last active August 22, 2019 09:36
HTTP и WebSocket Reverse Proxy

Background: это было написано для "фронт-энд" сервиса, который должен был проксировать HTTP и WebSocket-запросы на несколько внутренних сервисов.

Для того, чтобы переопределить то, как Phoenix обрабатывает вебсокеты, надо поменять настройки HTTP сервера (Cowboy), а именно настройки роутинга (:dispatch) — см. config.exs. Тут мы указываем, что для любого хоста: а) для пути "/aaa/websocket" вызывается хендлер API.Gateway.WSReverseProxy, б) для любого другого пути вызывается дефолтный хэндлер Phoenix.

API.Gateway.WSReverseProxy — это хэндлер Cowboy, для подробной информации о р

@kipcole9
kipcole9 / Map.Helpers
Last active October 24, 2023 22:13
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil
@ahmadshah
ahmadshah / randomizer.ex
Created September 1, 2016 10:28
Random string in elixir
defmodule Randomizer do
@moduledoc """
Random string generator module.
"""
@doc """
Generate random string based on the given legth. It is also possible to generate certain type of randomise string using the options below:
* :all - generate alphanumeric random string
* :alpha - generate nom-numeric random string
@nerdyworm
nerdyworm / rename.sh
Created July 30, 2016 17:40
rename a phoenix project
#!/bin/bash
set -e
CURRENT_NAME="CurentName"
CURRENT_OTP="current_name"
NEW_NAME="NewName"
NEW_OTP="new_name"
@gilyes
gilyes / Backup, restore postgres in docker container
Last active March 23, 2024 09:30
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@moklett
moklett / task1.exs
Last active April 18, 2023 19:58
Elixir Task - Crash Handling
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
end
def bad(message) do
IO.puts message
raise "I'm BAD!"
end
@subfuzion
subfuzion / curl.md
Last active April 29, 2024 01:31
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@keathley
keathley / possibly.ex
Created January 7, 2016 20:57
Monads and Maybes in elixir
defprotocol Functor do
def fmap(data, func)
end
defprotocol Applicative do
def pure(data)
def run(wrapped_func, data)
end
defprotocol Monad do