Skip to content

Instantly share code, notes, and snippets.

View jtmkrueger's full-sized avatar
🎉
Working from home

John Krueger jtmkrueger

🎉
Working from home
View GitHub Profile
@SuperMarioSF
SuperMarioSF / ModemManager.service
Last active February 28, 2024 01:27
ClockworkPi uConsole A06 Core LTE Module systemd service for automatic startup
[Unit]
Description=Modem Manager
After=polkit.service
Requires=polkit.service
ConditionVirtualization=!container
BindsTo=uConsoleLTE.service
[Service]
Type=dbus
BusName=org.freedesktop.ModemManager1
@lacostenycoder
lacostenycoder / README.md
Last active November 2, 2023 17:18
Ruby script to toggle night-mode hack on Slack Desktop app - Mac only, maybe linux

- IMPORTANT

For security, since this script injects CSS via AJAX, first fork the main slack night mode repo. The reason is explained here

UPDATE: The code has been modified to download the remote css to a local file and use ruby sass compiler to verify there is no malicious code in the remote css. This will error if the code has been modified to include anything malicious (i.e. script or img tags etc.) It's also been refactored to use the local file inside the js injection, it makes sure it's safe first in the very unlikely event the local file somehow differs from the remote css. The chances of this happening are remote, but this should suffice for safety.

Installation

  • save this script wherever you keep your ruby scripts for example ~/lacostenycoder/scripts/ruby/
  • change the URL in the remote_repo variable in ruby script to use YOUR repo. The rawgit.com file is crea
@rmeissn
rmeissn / outliersFilter.js
Last active July 20, 2021 12:13
A Javascript function to filter an array of values for outliers by using an interquartile filter
function filterOutliers(someArray) {
if(someArray.length < 4)
return someArray;
let values, q1, q3, iqr, maxValue, minValue;
values = someArray.slice().sort( (a, b) => a - b);//copy array fast and sort
if((values.length / 4) % 1 === 0){//find quartiles

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Kapeli
Kapeli / gist:5017177
Created February 22, 2013 22:43 — forked from yjsoon/gist:3474117
" Search Dash for word under cursor
function! SearchDash()
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
let s:url = "dash://".s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
map <leader>d :call SearchDash()<CR>
@shtirlic
shtirlic / mono.rb
Last active May 21, 2017 16:55
Latest mono formula for homebrew
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2'
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77'
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'
@leh
leh / restart_tmux
Created October 18, 2012 15:58
start or restore a tmux session named after your current working directory
# Switching projects like mad?
# t: start or restore a tmux session named after your current working directory
#
# e.g. calling t in /home/project/awesome_project will reattach the tmux session named
# awesome_project or create a new one
t() { tmux attach-session -t $(pwd | awk -F/ '{print $NF}') || tmux new-session -s $(pwd | awk -F/ '{print $NF}') ; }
@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@olistik
olistik / gist:2627011
Last active August 12, 2021 06:39
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git curl
  • Copy/paste from the command line:
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations