Skip to content

Instantly share code, notes, and snippets.

View Nicolab's full-sized avatar
:octocat:

Nicolas Talle Nicolab

:octocat:
View GitHub Profile
@Nicolab
Nicolab / Mac Keyboard Symbols.md
Created December 1, 2023 12:58 — forked from jlyonsmith/Mac Keyboard Symbols.md
List of Mac/Apple keyboard symbols

Common symbols

Modifiers

When a key combination is displayed, the modifiers are written in the order presented here. For example, Control + Option + Shift + Command + Q would be written as ⌃⌥⇧⌘Q.

Sym Key Alt
Control
Option
@Nicolab
Nicolab / migrate_redis.ex
Created September 14, 2022 07:52 — forked from alexandremcosta/migrate_redis.ex
Elixir Redis Migration Script (dump/restore)
defmodule MigrateRedis do
require Logger
@from [host: "127.0.0.1", port: 6379]
@to [host: "127.0.0.1", port: 6379]
def migrate(from \\ @from, to \\ @to) do
{:ok, from} = Redix.start_link(from)
{:ok, to} = Redix.start_link(to)
@Nicolab
Nicolab / downloader.ex
Created September 14, 2022 07:49 — forked from alexandremcosta/downloader.ex
Stream HTTP body with Elixir Mint
defmodule Downloader do
@moduledoc"""
Download streams of bytes from URLs.
Useful to transfer large files with low RAM usage.
## Example with `ExAWS.S3.upload/3`
```elixir
url
|> Downloader.stream_body!()
@Nicolab
Nicolab / factory.ex
Created March 2, 2022 17:50 — forked from atomkirk/factory.ex
Generating Example Data in Elixir
defmodule App.Factory do
alias App.Repo
def create(module, overrides \\ %{})
def create(module, overrides) when is_list(overrides), do: create(module, Map.new(overrides))
def create(module, overrides) do
attributes = module.example() |> Map.merge(overrides)
struct(module)
@Nicolab
Nicolab / notes.md
Created December 5, 2020 17:42 — forked from reterVision/notes.md
Linux Performance Tuning

1.1 Linux process management

  • process scheduling
  • interrupt handling
  • signaling
  • process prioritization
  • process switching
  • process state
  • process memory
@Nicolab
Nicolab / crystal_cre.md
Created January 17, 2020 13:43
Multi-line eval for Crystal lang. Write multi-line Crystal code in the stdin / terminal and eval it.

Eval multi-line code in stdin (terminal or SHELL script):

You can just write to crystal eval's stdin if you don't provide any arguments. Or no source argument, to be precise.

Just close stdin to eval it. Depends on you terminal, but usually Ctrl+D.

Another way:

@Nicolab
Nicolab / start_docker_compose.sh
Created January 23, 2018 08:46 — forked from ilourt/start_docker_compose.sh
Start script to use with systemd to take into account env var
#!/bin/bash
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT")
echo $SCRIPTPATH
export $(cat ${SCRIPTPATH}/.env | xargs)
docker-compose -f ${SCRIPTPATH}/docker-compose.yml up
@Nicolab
Nicolab / SassMeister-input.scss
Created September 28, 2017 10:05 — forked from pascalduez/SassMeister-input.scss
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
@Nicolab
Nicolab / import-github-labels.js
Created September 28, 2016 08:26 — forked from Isaddo/import-github-labels.js
import github labels via console command
/*
Go on your labels page (https://github.com/user/repo/labels)
Edit the following label array
or
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f)
and replace it
Paste this script in your console
Press Enter!!
@Nicolab
Nicolab / update-json.js
Last active August 29, 2015 14:06
Example of updateJson() with promise
var promise = require('bluebird');
var fs = primise.promisifyAll(require('fs'));
function updateJson(ticker, value) {
fs.readFileAsync('stocktest.json', 'utf8')
.then(function(contents) {
var stocksJson = JSON.parse(contents);