Skip to content

Instantly share code, notes, and snippets.

View cherryramatisdev's full-sized avatar
🏠
Working from home

Cherry Ramatis cherryramatisdev

🏠
Working from home
View GitHub Profile
@cherryramatisdev
cherryramatisdev / web_search_terminal_en.md
Created June 26, 2024 01:28
How to search the web from the terminal (EN)
  1. Make sure you installed the w3m CLI
  2. Create a script like websearch with the following content:
#!/bin/sh

query=""
for arg in "$@"; do
    query="$query+$arg"
done
@cherryramatisdev
cherryramatisdev / web_search_terminal_pt_br.md
Last active June 26, 2024 01:28
Como pesquisar na web a partir do terminal (PT-BR)
  1. Certifique-se de ter instalado a CLI w3m
  2. Crie um script como websearch com o seguinte conteúdo:
#!/bin/sh

consulta=""
para argumento em "$@"; fazer
    consulta="$consulta+$arg"
feito
#!/usr/bin/env bash
pbcopy
pane_count=$(tmux list-panes | wc -l)
edit() {
local current_pane="$(tmux list-panes -F "#{pane_active} #{pane_pid} #{pane_current_command}" | grep "^1" | awk '{print $3}')"
if [ "$current_pane" = "nvim" ] || [ "$current_pane" = "nvi" ] || [ "$current_pane" = "Vim" ] || [ "$current_pane" = "vim" ]; then
let mapleader = ' '
" Enable filetype detection and plugin functionality
filetype plugin on
" Enable syntax highlighting
syntax on
" Set the tab size to 2 spaces
set tabstop=2
@cherryramatisdev
cherryramatisdev / pkg.pl
Last active December 14, 2023 17:44
Script to automagically detect the different node package managers
#!/usr/bin/env perl
use v5.14;
use warnings;
use strict;
my $dir = `git rev-parse --show-toplevel`;
$dir =~ s/^\s+|\s+$//g;
@cherryramatisdev
cherryramatisdev / .tmux.conf
Created December 12, 2023 17:32
tmux.conf
set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# start window indexing at one instead of zero
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
setw -g mode-keys vi
# fix accidently typing accent characters, etc.
@cherryramatisdev
cherryramatisdev / list_discussions.sh
Last active November 28, 2023 14:11
How to list all the discussions within a repo
#!/usr/bin/env bash
gh api graphql \
-f query="
query {
repository(owner: \"ORG\", name: \"REPO_NAME\") {
discussions(first: 29) {
edges {
node {
title
alias sync="stow . -t ~/"
alias chmox="chmod +x"
alias l=exa
alias ls=exa
alias ll="exa -ll"
alias la="exa -la"
alias lg=lazygit
# alias vi="$EDITOR"
alias vi="vim"
@cherryramatisdev
cherryramatisdev / result_monad.rb
Created October 21, 2023 04:46
A simple result monad implemented with type safety using sorbet
# frozen_string_literal: true
# typed: true
require 'sorbet-runtime'
# Result...
module Result
extend T::Sig
# Ok...
@cherryramatisdev
cherryramatisdev / pull_request.lua
Last active October 12, 2023 23:55
Simple module to manage pull request creation within neovim
local M = {}
---@return 'main' | 'develop'
local function decide_base_branch()
if vim.fn.system 'git branch --contains develop' == 'error: malformed object name develop' then
return 'main'
end
return 'develop'
end