Skip to content

Instantly share code, notes, and snippets.

View jenrzzz's full-sized avatar

Jenner La Fave jenrzzz

View GitHub Profile
@janko
janko / application_controller.rb
Last active May 8, 2021 06:58
Simpler implementation of ActionController::Live
class ApplicationController < ActionController::Base
private
def stream_body(async: false, **options, &block)
self.status ||= 200
self.headers["Cache-Control"] = "no-cache"
self.headers.delete("Content-Length")
stream_class = async ? AsyncStream : Stream
@dreness
dreness / dezalgo.php
Last active February 25, 2016 22:27
exorcise the mind of zalgo from a text file
## install composer
# mkdir dezalgo ; cd dezalgo
## place dezalgo.php (this file) into the new directory
# composer require mdwheele/zalgo
# php dezalgo.php --infile MyBestIRCLog --outfile MySafeIRCLog
<?php
require __DIR__ . '/vendor/autoload.php';
use Zalgo\Mood;
use Zalgo\Soul;
@daniel-j-h
daniel-j-h / ld.gold.sh
Last active September 22, 2023 00:54
default to ld.gold on Ubuntu'ish
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
update-alternatives --config ld
ld --version
GNU gold
export CPP=cpp-5 gcc-5 g++-5
env CXXFLAGS='-march=native -flto -fuse-linker-plugin' cmake .. -DCMAKE_BUILD_TYPE=Release
@wvengen
wvengen / README.md
Last active March 25, 2024 07:53
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

@fogleman
fogleman / words.md
Last active May 3, 2024 14:43
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is
@jdiaz5513
jdiaz5513 / ascii_arty.py
Last active December 30, 2023 02:32
Console ASCII Art Generator
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor
from colormath.color_objects import sRGBColor as RGBColor
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true