Skip to content

Instantly share code, notes, and snippets.

View mxdevmanuel's full-sized avatar

Manuel Morales mxdevmanuel

View GitHub Profile
@mxdevmanuel
mxdevmanuel / AutoHotkey.ahk
Last active May 4, 2023 01:28
AutoHotkey CAPSLOCK to Control on Hold and ESC on tap. Also VIM key movements using RAlt as a layer modifier
; If CAPSLOCK is up before a 100 milisecond send Escape else keep CTRL pressed until CAPSLOCK is released
*CapsLock::{
Send "{Blind}{Ctrl Down}"
released := KeyWait("CAPSLOCK", "T0.1")
If (released)
Send "{Blind}{Ctrl Up}{Esc}"
}
*CapsLock up::Send "{Blind}{Ctrl Up}"
@mxdevmanuel
mxdevmanuel / README.md
Last active December 28, 2021 14:54
Next.js + Typescript + TailwindCSS + Storybook

Next.js + Typescript + TailwindCSS + Storybook configuration

This is no definitive or ultimate guide, just my preferred way to do this

Versions at the time of writing

  • Nodejs v14.17.3
  • Typescript v4.5.4
  • Next.js v12.0.7
  • React v17.0.2
  • TailwindCSS v3.0.7
@mxdevmanuel
mxdevmanuel / powermenu.sh
Created July 30, 2021 18:45
Sway power menu
#!/usr/bin/env bash
op=$( echo -e " Poweroff\n Reboot\n Suspend\n Lock\n Logout" | wofi -i --dmenu | awk '{print tolower($2)}' )
case $op in
poweroff)
;&
reboot)
;&
suspend)
@mxdevmanuel
mxdevmanuel / dart.ctags
Created April 25, 2020 17:04
Dart ctags (tested with universal-ctags) WIP
--langdef=dart
--langmap=dart:.dart
--regex-dart=/^[ \t]*enum[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/e,enum/
--regex-dart=/^[ \t]*class[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/c,class/
--regex-dart=/^[ \t]*var[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/v,variable/
@mxdevmanuel
mxdevmanuel / iplist.sh
Created April 17, 2020 17:29
Select, copy and paste ip address from list (requires xclip, xdotool, fzf and/or dmenu)
#!/bin/env bash
TOOL=dmenu
if [[ -t 1 ]]; then
TOOL=fzf
fi
ADDR=$(ip -oneline -4 addr | awk '{print $2, $4}'| $TOOL | awk '{print $2}' | perl -pe 's/\/\d+//')
echo $ADDR | xclip -i -selection clipboard
@mxdevmanuel
mxdevmanuel / run_npm_popupmenu.vim
Created January 4, 2020 19:02
Run npm script from within vim with popup_menu
func NpmSelected(id, result)
let cmd = "npm run " . b:ks[a:result - 1]
exec "terminal " . cmd
endfunc
function! RunNpm()
if filereadable("./package.json")
let st = readfile("./package.json")
let package = json_decode(join(st, " "))
if has_key(package, "scripts")
@mxdevmanuel
mxdevmanuel / hdmi.sh
Created August 7, 2019 17:21
i3 hdmi detect
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/manuel/.Xauthority
export XDG_RUNTIME_DIR=/run/user/$(id -u)
hdmi_active="$(cat /sys/class/drm/card0/*HDMI*/status | grep '^connected')"
echo $hdmi_active
if [[ "$hdmi_active" == "connected" ]]; then
@mxdevmanuel
mxdevmanuel / commands.sh
Created July 4, 2019 13:19
Engineer man convinience copy
# 1. redo last command but as root
sudo !!
# 2. open an editor to run a command
ctrl+x+e
# 3. create a super fast ram disk
mkdir -p /mnt/ram
mount -t tmpfs tmpfs /mnt/ram -o size=8192M
@mxdevmanuel
mxdevmanuel / fix_qt_x11.h
Created July 4, 2018 04:37
Solve the conflict when using Xlib.h and the Qt framework undefining the conflicting definitions
#ifdef __linux__
#undef Bool
#undef CursorShape
#undef Expose
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef None