Skip to content

Instantly share code, notes, and snippets.

View lcrespom's full-sized avatar

Luis Crespo lcrespom

View GitHub Profile
@lcrespom
lcrespom / luiscrespo.zsh-theme
Created November 18, 2024 10:13
My oh-my-zsh personal theme
# Use Bun to generate a nice, colorful prompt
function luis-prompt() {
HOME=$HOME && HOST=$HOST bun $ZSH/themes/luis-prompt/src/index.ts
}
# Show a red arrow if there was an error in the previous command
PROMPT="%(?::%{$fg_bold[red]%}%1{➜ %})"
# Show the main part of the prompt (with path and git status)
PROMPT+='$(luis-prompt)'
# Add a newline and custom prompt character
@lcrespom
lcrespom / settings.json
Last active March 3, 2024 08:28
My VSCode Settings
{
"workbench.colorTheme": "Monokai",
"editor.renderLineHighlight": "gutter",
"editor.fontSize": 14,
"redhat.telemetry.enabled": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"security.promptForLocalFileProtocolHandling": false,
"[sql]": {
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"

Python problems

Python is the nicest programming language, very clear and concise at the same time, powerful, versatile and expressive. However its tooling is continuonsly making life very hard to the developer. Here are some of the problems I have encountered.

1. Horrible package / dependency management

The dependency and package management is flawed by design: by default, all dependencies are downloaded to a common, system-wide path. This quickly results in dependency conflicts, so that nobody uses this default approach and resort to one of multiple workarounds.

Workarounds consist on defining some local virtual environment, which the user must explicitly "enter" when working on a project by issuing some command, and explicitly leave with another command. It's not really clear which of the workarounds one should use, as they are quite similar but not the same.

@lcrespom
lcrespom / focus-maximized.swift
Last active February 24, 2023 11:39
Swift code to give focus to the largest application window
#!/usr/bin/swift
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title Focus on maximized window
// @raycast.mode silent
// Optional parameters:
// @raycast.icon 🖥️
@lcrespom
lcrespom / spanish-word-macro.md
Created January 3, 2022 09:54
Spanish word macro

Spanish word macro

To set the whole document to Spanish (or any other language), create the following macro:

Sub SetSpanish()
'
' SetSpanish Macro
'
'
    pos = Selection.End
 Selection.WholeStory
const keypress = require('keypress')
const chalk = require('chalk')
//------------------------- KB handling -------------------------
function listenKeyboard(kbHandler) {
process.stdin.setRawMode(true)
process.stdin.resume()
keypress(process.stdin)
const parse = require('bash-parser')
function traverseAST(node, nodeCB) {
if (node.commands) {
for (cmd of node.commands)
traverseAST(cmd, nodeCB)
}
else {
nodeCB(node)

Installing and customizing oh-my-zsh

Install oh-my-zsh

curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash

Install autosuggestions and syntax-highlight plugins

From the zsh shell:

Installing minikube on Linux

Environment

  • Installation performed on Ubuntu Server 19.10.
  • Running on Virtual Box
  • Installation from https://ubuntu.com/download/alternative-downloads => network installer (mini.iso)
  • During installation: add "SSH Server" and "Basic Ubuntu Server" (the two at the bottom of the list)

Installation

Install docker:

// Run this code in chrome JS console
nl = document.querySelectorAll('#header, .pagehead, .breadcrumb, .commit, .meta, #footer, #footer-push, .wiki-actions, #last-edit, .actions, .header,.site-footer,.repository-sidebar,.file-navigation,.gh-header-meta,.gh-header-actions,#wiki-rightbar,#wiki-footer,.commit-tease')
for (n of nl) n.parentNode.removeChild(n)
nl = document.querySelectorAll('#files, .file')
for (n of nl) { n.style.background = "none"; n.style.border = "none" }
nl = document.querySelectorAll('link')
for (n of nl) n.removeAttribute('media');
var removeMe = document.getElementsByClassName("file-header")[0];
removeMe.parentNode.removeChild(removeMe);