Skip to content

Instantly share code, notes, and snippets.

View jheidt's full-sized avatar
💭
:shipit: 👍

Jake jheidt

💭
:shipit: 👍
View GitHub Profile
@deviantintegral
deviantintegral / compress-tables.sh
Created April 12, 2012 17:27
Compress MySQL Tables
#!/usr/bin/env bash
# Compress MySQL tables on disk.
# Author: Andrew Berry, andrew.berry@lullabot.com
#
# Compress all tables in a MySQL InnoDB database using compression from the
# Barracuda table format. Tables have to already be in the Barracuda file
# format to actually compress tables, otherwise the table setting is ignored.
#
# innodb_file_per_table = 1 MUST be set in my.cnf for compression to work.
@edwardgalligan
edwardgalligan / README.md
Created November 3, 2020 11:50
Quick hack to export container mapping from Firefox Multi-Account Containers

This is a very simplistic hack, and doesn't do a lot for you so there's a few steps.

  1. Go to about:addons, click the gear button and select Debug Addons
  2. Debug the Firefox Multi-Account Containers add-on
  3. Go to the console tab and paste in the code below
  4. Right-click on the output and choose Export Visible Messages To
@mustafaturan
mustafaturan / ruby.2.6.3-setup.sh
Last active February 2, 2023 10:08
ruby 2.6.3 setup for centos 6.x
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick
@sj26
sj26 / assets.rake
Last active May 13, 2023 04:42
Don't discard cache during asset precompile. Full explanation and caveats: http://sj26.com/2013/02/09/the-asset-pipeline-isnt-actually-slow
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
@rtomayko
rtomayko / optparse-template.rb
Last active June 3, 2023 03:16
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@brianjlandau
brianjlandau / deep_freeze.rb
Created September 2, 2009 16:05
Deep freeze for enumerable objects in Ruby
module Enumerable
def deep_freeze
unless self.is_a? String
frozen = self.dup.each do |key, value|
if (value.is_a?(Enumerable) && !value.is_a?(String))
value.deep_freeze
else
value.freeze
end
end
@nickyp
nickyp / self_signed_cert.rb
Last active September 4, 2023 23:46
create a self-signed certificate using ruby-openssl
We couldn’t find that file to show.
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active September 8, 2023 17:57
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@xuhdev
xuhdev / ctags_with_dep.sh
Last active November 7, 2023 15:51
Generate ctags file for C or C++ files and its depedencies (included header files). This could avoid you to always generate a huge tags file.
#!/bin/sh
# https://www.topbug.net/blog/2012/03/17/generate-ctags-files-for-c-slash-c-plus-plus-source-files-and-all-of-their-included-header-files/
# ./ctags_with_dep.sh file1.c file2.c ... to generate a tags file for these files.
gcc -M "$@" | sed -e 's/[\\ ]/\n/g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | \
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
@kriegsman
kriegsman / TwinkleFOX.ino
Last active January 9, 2024 02:20
TwinkleFOX: Colored Twinkling Holiday Lights
#include "FastLED.h"
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define NUM_LEDS 100
#define LED_TYPE WS2811
#define COLOR_ORDER GRB