Skip to content

Instantly share code, notes, and snippets.

View nicolasdanelon's full-sized avatar
🖖
live long and prosper

Nicolas Danelon nicolasdanelon

🖖
live long and prosper
View GitHub Profile
@nicolasdanelon
nicolasdanelon / borrowing.rs
Created January 2, 2023 19:36
understanding rust concepts
// Borrowing allows you to reference data without taking
// ownership of it. This can be useful when you have a large data
// structure and you don't want to copy it, or when you want to
// allow multiple parts of your code to access the same data.
fn main() {
let s1 = String::from("hello");
let len = calculate_length(&s1); // s1 is borrowed by the function
println!("The length of '{}' is {}.", s1, len);
pacman -S --needed xorg sddm i3 i3-wm i3lock i3status feh dmenu rofi firefox kitty the_silver_searcher vim htop ttf-fira-mono ttf-hack ttf-joypixels ttf-ubuntu-font-family
yay -y i3blocks i3-gaps
systemctl enable sddm
cat ~/.config/i3/config
mkdir ~/.config/i3/i3status
cp /etc/i3status.conf ~/.config/i3/i3status/default.conf
@nicolasdanelon
nicolasdanelon / kill-firebase-emu-switch.sh
Created December 5, 2022 13:30
Dead simple script for kill processes (firebase emulators) by port, blazingly fast
#!/bin/bash
for i in 9001 8086 8081
do
lsof -i tcp:$i | head -n 2 | tail -n 1 | awk '{print $2}' | xargs kill
done
@nicolasdanelon
nicolasdanelon / Cargo.toml
Created July 26, 2022 19:49
problem line 23
[package]
name = "rust-json"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
@nicolasdanelon
nicolasdanelon / docker-compose.yml
Created April 27, 2022 16:11
docker compose -> kafka - zookeeper - postgres - pgadmin
version: "2"
services:
zookeeper:
image: docker.io/bitnami/zookeeper:3.8
ports:
- "2181:2181"
volumes:
- "zookeeper_data:/bitnami"
environment:
@nicolasdanelon
nicolasdanelon / install-arch.sh
Created April 25, 2022 15:47
Quick and simple guide - ArchLinux install
timedatectl set-ntp true
fdisk /dev/sda
o
n
p
1
+300M
a
n
p
@nicolasdanelon
nicolasdanelon / .zshrc
Created January 24, 2022 23:26
script not working on .zshrc file
function myMacStatus()
system_profiler_cache=$(system_profiler SPPowerDataType)
battery_cicles=$(echo $system_profiler_cache | grep 'Cycle Count' | awk '{print $3}')
battery_charge=$(echo $system_profiler_cache | grep 'State of Charge' | awk '{print $5}')
battery_condition=$(echo $system_profiler_cache | grep 'Condition' | awk '{print $2}')
echo "\n"
# echo "Life used by SSD: $(smartctl -a disk0 | grep 'Percentage Used' | awk '{print $3}')"
echo Battery cycles: $battery_cicles
@nicolasdanelon
nicolasdanelon / user.php
Last active April 25, 2022 15:50
user.php
// https://www.wikiwand.com/es/SOLID
// Service Repository Pattern
class User {
private string $name;
}
class UserRepository {
public function getUserName(int $id): string
{
import React, { Component } from 'react';
class App extends React {
constructor(props) {
super(props);
this.state = {
liveRequest: false,
};
}

Keybase proof

I hereby claim:

  • I am nicolasdanelon on github.
  • I am nicolasdanelon (https://keybase.io/nicolasdanelon) on keybase.
  • I have a public key whose fingerprint is 8AAD 8815 360E 8776 BF11 3A07 7983 32C6 65A5 51BB

To claim this, I am signing this object: