Skip to content

Instantly share code, notes, and snippets.

View ivanhercaz's full-sized avatar
🦉
Working to achieve my dreams!

Iván Hernández Cazorla ivanhercaz

🦉
Working to achieve my dreams!
View GitHub Profile
@ivanhercaz
ivanhercaz / form_component.ex
Last active November 17, 2021 14:21
Replace AlpineJS click-show using LiveView assigns on a form component
defmodule AppWeb.ExampleLive.FormComponent do
use AppWeb, :live_component
alias App.Examples
@impl true
def update(%{example: example} = assigns, socket) do
changeset = Examples.change_example(example)
{:ok,
@ivanhercaz
ivanhercaz / ssh_agent_forwarding.md
Last active July 13, 2021 21:50
Reenvío de agentes (AgentForwarding) o cómo utilizar tu clave SSH en otro servidor

A veces tenemos que trabajar en local, otras en un servidor y otras en diferentes servidores. Tenemos la opción de tener una clave SSH para cada uno de ellos, ¿por qué no? Pero también tenemos la posibilidad de utilizar una clave local específica.

ssh-agent

Un agente ssh (ssh-agent) es un mecanismo que almacena las claves privadas decodificadas en memoria como un proceso en segundo plano. Para ello debemos asegurarnos de tener ssh-agent en ejecución:

eval "$(ssh-agent)"
@ivanhercaz
ivanhercaz / application.ex
Created July 12, 2021 18:33
Basic supervision tree with Elixir (example provided by @Quarkex).
defmodule Client.Application do
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
{Client, []}
]
@ivanhercaz
ivanhercaz / config.exs
Last active May 15, 2020 20:38
Try to use Mox to create a mock to handle errors of HTTPoison
# config/config.exs
import Config
config :ex_tldr, http_client: HTTPoison
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ivanhercaz
ivanhercaz / result_file_name
Created January 17, 2020 02:18
[tldr-pages] Token consistency: filename or file_name
pages/common/git-checkout.md:{{file_name}}
pages/common/git-checkout.md:{{file_name}}
pages/common/ignite.md:{{file_name}}
pages/common/odps-resource.md:{{file_name}}
pages/common/p4.md:{{file_name}}
pages/common/sc-im.md:{{file_name}}
pages/common/terminalizer.md:{{file_name}}
pages/common/terminalizer.md:{{file_name}}
pages/common/terminalizer.md:{{file_name}}
pages/common/terminalizer.md:{{file_name}}
@ivanhercaz
ivanhercaz / count_files_in_subdirs.py
Last active January 16, 2020 01:26
a small script to count files in subdirs and create a graph with Plotly (and then show it in a website created with Flask)
directories = [pages_dir for pages_dir in dirs if "pages" in pages_dir]
for directory in directories:
print(directory)
for subdir in next(os.walk(f"{directory}"))[1]:
print(subdir)
print(len(next(os.walk(f"{directory}/{subdir}"))[2]))
@ivanhercaz
ivanhercaz / CanaryBot_error_duplicated
Last active February 2, 2019 01:33
Error that happened when the option "Remove duplicates automatically" is chosen. The script deletes the full stop of the description, but it repeats several and different times according to the item the actions of "update log" and "add to the duplicated descriptions file". It also can be checked in the log file: https://paws-public.wmflabs.org/p…
Q29486590 Gelli Gason
- en-desc: Grade II listed building in Llanfair Caereinion. Farmhouse within farm with cart shed and granary and barn, 1km E of LlanfairCaereinion Church.
+ Replacement: Grade II listed building in Llanfair Caereinion. Farmhouse within farm with cart shed and granary and barn, 1km E of LlanfairCaereinion Church
[?] What do you want to do?: Remove duplicates automatically
Remove full stop
Add description to checklist
Edit description
> Remove duplicates automatically
Skip description

Keybase proof

I hereby claim:

  • I am ivanhercaz on github.
  • I am ivanhercaz (https://keybase.io/ivanhercaz) on keybase.
  • I have a public key ASDnXqR4hAa5muD4a2Ivx1THpNCybdZEp41FqC1lYOY8Hwo

To claim this, I am signing this object:

$wgEnableWikibaseRepo = true;
$wgEnableWikibaseClient = true;
require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
$GLOBALS['wgWBClientSettings']['siteGlobalID'] = "enwiki";