Skip to content

Instantly share code, notes, and snippets.

View lacostenycoder's full-sized avatar
👓
Tooling not fooling

Lance Jordan lacostenycoder

👓
Tooling not fooling
View GitHub Profile
@lacostenycoder
lacostenycoder / suppress_ruby_output.rb
Created April 22, 2022 01:34 — forked from moertel/suppress_ruby_output.rb
Temporarily suppress STDOUT and STDERR (ruby)
# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
# suppress_output { puts 'never printed' }
#
def suppress_output
original_stderr = $stderr.clone
original_stdout = $stdout.clone
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))
@lacostenycoder
lacostenycoder / screen-brightness
Created December 24, 2021 09:53 — forked from lagerone/screen-brightness
A script for adjusting screen brightness in Dell laptops with OLED screens in Ubuntu. It requires xrandr to be installed.
#!/usr/bin/python3
import logging
import os
import subprocess
import sys
from typing import Literal
logging.basicConfig(level=logging.DEBUG)
@lacostenycoder
lacostenycoder / install-open.sh
Last active October 21, 2021 14:28 — forked from ozanmuyes/install-open.sh
Mac OSX 'open' equivalent for Debian for zsh
#!/bin/bash
# echoes '#!/bin/bash xdg-open "$1" &> $HOME/.xdg-open-error &' to /usr/sbin/open
echo -e "\043\041/bin/bash\n\nxdg-open \042\044\061\042 &> $HOME/.xdg-open-error &" > ozanmuyes-open
sudo mv ozanmuyes-open /usr/sbin/open
sudo chmod +x /usr/sbin/open
echo -e "\n# Mac OSX \047open\047 equivalent for Debian\nalias 'open'='/usr/sbin/open'" >> $HOME/.zshrc
. $HOME/.zshrc
@lacostenycoder
lacostenycoder / README.md
Last active February 14, 2021 14:59 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)

In newer versions of chrome you may not be able to just drag the code to your quick shortcuts. As a workaround you can just do:

  1. Copy the raw javascript in bookmark.min.js to your clipboard.
  2. right-click on the the bookmarks bar and add select add page
  3. for the name type DebugCSS
  4. for page type javascript:/ then paste the js you copied in step 1
  5. click save.
  6. Do a happy dance, your done! Happy Dance
@lacostenycoder
lacostenycoder / pre-commit
Created July 19, 2016 01:18 — forked from wacko/pre-commit
Git hook to avoid commit debug lines (binding.pry console.log debugger...)
#!/usr/bin/env ruby
# Validates that you don't commit forbidden keywords to the repo
# You can skip this checking with 'git commit --no-verify'
exit 0 if ARGV.include?('--no-verify')
# Update this list with your own forbidden keywords
KEYWORDS = %w(binding.pry console.log debugger)
def red(text) "\033[31m#{text}\033[0m"; end