Skip to content

Instantly share code, notes, and snippets.

View andostronaut's full-sized avatar
🦕

Ando andostronaut

🦕
View GitHub Profile
@andostronaut
andostronaut / nerd_fonts.md
Created October 16, 2024 18:35 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
@andostronaut
andostronaut / index.py
Created August 14, 2024 08:12
Port scanning in Python
import socket
def port_scanner(host, ports):
hostname = socket.gethostbyname(host)
print(f'Scanning {host}: {hostname}')
for port in ports:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)
result = sock.connect_ex((hostname, port))
@andostronaut
andostronaut / settings.json
Created July 17, 2024 18:17
Enable Deno LSP in Zed
{
"lsp": {
"deno": {
"settings": {
"deno": {
"enable": true
}
}
}
}
git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
@andostronaut
andostronaut / star-candidats.php
Last active March 14, 2024 13:19
Create custom table with WP_Liste_Table for star
<?php
/*
* Plugin Name: Star Candidats
* Description: Liste des candidats qui ont postuler sur les offres star.
* Plugin URI: https://gist.github.com/iamando/8389c81a88afec8baf74c51c3b91112d
* Author: Ando
* Author URI: https://github.com/iamando
* Version: 1.0
* License: GPL2
*/
@andostronaut
andostronaut / auto-assign.yml
Created July 27, 2023 16:10
GitHub Workflow : Auto Assign
name: Auto Assign
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
permissions:
@andostronaut
andostronaut / app.tsx
Last active July 27, 2023 16:10
Using DeepReadonly, we cannot mutate anything in the entire tree, preventing a whole range of bugs that could occur.
export function EditEvent() {
const [event, setEvent] = useState<DeepReadonly<Event>>()
// ...
// ❌
event.attendees.push('foo') // Error
// ✅
setEvent({
...event,