Skip to content

Instantly share code, notes, and snippets.

@jjb
jjb / file.md
Last active April 19, 2024 09:09
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There are various benchmarks and discussions. Legend had it that Jemalloc 5 doesn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. Someone offered a config for Jemalloc 5.

The recipe would be something like this (shown with official docker ruby image).

FROM ruby:3.1.2-bullseye
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@djs55
djs55 / docker-desktop-mutagen-builds.md
Last active July 25, 2020 13:30
Development builds containing the Docker Desktop + Mutagen integration

This is a list of Docker Desktop for Mac development builds which contain mutagen. These are based on Edge, but may contain unexpected bugs. They should be used for testing the Mutagen feature rather than for production work.

2020-07-14: development snapshot: https://desktop-stage.docker.com/mac/edge/46638/Docker.dmg

  • Exclude files from a mutagen sync based on the .dockerignore file.
  • Flush around docker exec as well as docker run for more reliable scripting.
  • Fix a bug which could result in duplicates in the list of synchronised directories.
  • Allow the sync to be bypassed by using :consistent or :cached. In particular this means if you want the previous :delegated behaviour before mutagen, switch to :cached. This
@vasind
vasind / ember-cli-build.js
Last active June 8, 2023 04:33
Ember CLI performance improvements and tips
// Credits to the following posts that helps me to reduce build times drastically
// https://discuss.emberjs.com/t/tips-for-improving-build-time-of-large-apps/15008/12
// https://www.gokatz.me/blog/how-we-cut-down-our-ember-build-time/
//ember-cli-build.js
let EmberApp = require('ember-cli/lib/broccoli/ember-app');
let env = EmberApp.env(),
@jacmkno
jacmkno / healthcheck.sh
Last active October 3, 2022 18:22
This script runs health checks in a set of hosts and updates their status on an nginx server. It also sends email notifications with the linux mail command. All other dependencies come natively with linux. It is a great alternative to the comercial nginx health_heck feature.
#!/bin/bash
# By @jacmkno - Activisual S.A.S. - http://activisual.net
# Script summary
# This script runs health cehcks in a set of hosts and updates their status on an nginx server
HOSTS=(201.208.65.152 46.56.115.234 42.79.216.211)
HOSTS_COUNT=3 # Number of hosts in the array
MAIL_SUBJECT='ACTIVISUAL - Health check status change'
MAIL_TO='webmaster@website.net'
NGINX_CONF=/etc/nginx/nginx.conf
@kujohn
kujohn / portforwarding.md
Last active January 21, 2022 02:36
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@bryanstearns
bryanstearns / gist:4331076
Created December 18, 2012 19:23
I put this in my basebox postinstall scripts to help NTP deal with large time differences
# Make sure ntpd doesn't give up if the time is way off
cp /etc/ntp.conf /etc/ntp.conf.old
(echo tinker panic 0; cat /etc/ntp.conf.old) >/etc/ntp.conf
/etc/init.d/ntp restart
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);