Skip to content

Instantly share code, notes, and snippets.

View andostronaut's full-sized avatar
🛰️
on orbit

Ando andostronaut

🛰️
on orbit
View GitHub Profile
@andostronaut
andostronaut / docker_exec.sh
Last active March 3, 2025 14:08
Terminate PostgresSQL in Docker
docker exec -it container_name psql -U db_user -d postgres
@andostronaut
andostronaut / init.lua
Last active February 15, 2025 06:10
Github Copilot - Neovim Setup
{
"github/copilot.vim",
lazy = false,
config = function() -- Mapping tab is already used by NvChad
vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
vim.g.copilot_tab_fallback = ""
-- The mapping is set to other key, see custom/lua/mappings
-- or run <leader>ch to see copilot mapping section
vim.g.copilot_filetypes = {
@andostronaut
andostronaut / NvChad.md
Created January 3, 2025 07:57 — forked from kashifulhaque/NvChad.md
Neovim stuff with NvChad

Neovim keybinds

  • Capital letters do the opposite of small letters in command (Press shift to trigger capital letters)
  • _ (underscore) to move the cursor at the beginning of line (doesn't switch to insert mode)
    • 0 (zero) moves the cursor to the zeroth position of the line (doesn't switch to insert mode)
  • $ (dollar) to move the cursor at the end of line (doesn't switch to insert mode)
  • d$ will delete from wherever your cursor is till the end of the line
  • f<character> to move cursor to the first occurrence of <character>
    • f( to move cursor to first occurence of (
  • t<character> to move cursor to upto but not on the first occurrence of <character>
  • t( to move cursor to first occurence of (
@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,