Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
LIMIT = 128 * 4
puts "Scanning memory stats..."
$lines = []
IO.popen("passenger-memory-stats") do |io|
$lines = io.readlines
end
@whilei
whilei / groom-passenger-not-politcally-correct.rb
Last active August 5, 2016 23:21 — forked from donnoman/gist:233083
for weirdly acting passenger/nginx shit on your server
#!/usr/bin/env ruby
# based on http://gist.github.com/29838
# logging to syslog added
# added killing orphaned procs
# added culling applications to maintain some per application limits
# Find bloating passengers and kill them gracefully. Run from cron every so often.
#
require "rubygems"
require "logging"
@whilei
whilei / find-rows-with-numbers.py
Last active August 5, 2016 23:20
give me real data...
# coding: utf-8
import re
import os
import csv
print "Welcome to the DIGITIZER!"
print "=" * 40
print "I'll print all rows containing digits from one CSV into another csv file."
print "-" * 40
@whilei
whilei / directory-reader.coffee
Created June 1, 2016 00:49 — forked from rodw/directory-reader.coffee
Here's a little CoffeeScript routine that will recursively read the file-system, generating an object that represents a complete directory tree. This gist should be executable. You can run it with: `coffee directory-reader.coffee [FILENAME]` to dump a JSON representation of the object to stdout.
# Here's a little CoffeeScript routine that will recursively
# read the file-system, generating an object that represents
# a directory tree.
# The returned object will contain the following attributes:
#
# * `file` - the basename of the file.
# * `dir` - the directory containing the file.
# * `types` - an array containing zero or more of
# "File", "Directory", "SymbolicLink", "BlockDevice",
@whilei
whilei / is-it-a-mobile-device.js
Last active August 5, 2016 23:19
check if device mobile
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
@whilei
whilei / make-jpgs-gifs.sh
Last active August 5, 2016 23:19
imagemagick gif
convert -delay 20 -loop 0 *jpg animated.gif
@whilei
whilei / gulpfile.js
Last active August 5, 2016 23:24
real basic gulp sass compiler, to one-off or watch
'use strict';
// $ npm install gulp gulp-sass gulp-concat --save-dev
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
const sassPath = './public/assets/sass/**/*.scss';
const cssPath = './public/assets';
@whilei
whilei / emojis.js
Last active August 5, 2016 23:23
every single github emoji in base64 in json format
[
{
"text": ":blush:",
"base64EncodedString": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAUC0lEQVR4Xu2bC4wd1XnHf9+Zmfvau+vd9bJesEwW29g8YkrAmDyoZQgBCg2FIkIJJijQqKqI2pREqWii0FZtg4SaoKhpFapEIUBISJtAHm0gJIFAeMUYEpI4NtgY/MC7Xntfd+9r5pyvO3dONWKDF5wCJmqu9NcZ3Tnzne/3P+fMmTN3l999fqff6f+15LUG+Fsw69ezNFRWYThehOUCQyaQXpSKz6LurE4o7FHlGRy/SISnbr2VbX8L7rfRAHn2ctaocH4UcJaJ5LggMhVTMJiCIEYgmNO0VdQprp3KYWNXd7H+MrbcI8o3j7qFxwB9Qxuw4d1UFvbyHhNwZaFk3hGUjTGVAFNMwRUxDgl0VgIyp2lV1KYS1BlcW3Ath6tbbMO5dtP92Fm+sG+CO1Z/i/obyoAfriMcXsL6MJIPF8rmzUF3iOkyBCXFRA4pFjDlXoKeI6BrEKkMIYUqYgoAqGuj7Rpa3wMzo9ip3bjGBNpq42KDbQpuxmGnE9oN9/Mk1n/evoNbT7+P5JAbsPm9rClF/FOpGrwzXBAS9gRI0WJKIWHvEszQWzCLTkaqy5FSP4QVkMC3rHkaCqiFpI4296O1Z3Ajj+P2PEEysQPXTNBWQDJlSSYTmjX7/WbM36z8Mo8dKgNk22VcU6rI3xX6oq6gNyKsOEwlJFy0iuBNZ2EOWwPlfg+XAA5U85aVlzgWwICEIEBjP27vY9jn7iEZeQpXT0jqBjsR0x6PZ5p1vW7pbXwK0NfLANlwMT2HlfmXUnewPhooEC4ICMqWcHAFwfKLMINvhbAE2ga1iBh+k4+q86OlAEkTN/oI9pn/JBndgm0EJJOWeKxNc9reurfBB1d/jSlAX0sDZOP5HN7fz22VBeG6aFGBsFsIq7PlsrMxwxchxV5wTQRA5DdrbS6CKgp
@whilei
whilei / edit-git-config-at-large.sh
Last active August 5, 2016 23:16
Shit, I changed by Github username...
# Want to change your Github username?
# Want to change the url of your self-hosted git remote handler (ie Gogs)?...
# This solve is to find every .git/config file (which is where each project-related git configuration lives) and edit
# according to your whims. That's where the `sed...` part comes into the play. `sed s/x/y/g` will substitute all
# x for y globally in the given file. The given file in this case is the `find`ers.
# In the examples, the `-i.bak` part is making a backup just in case which you needn't worry about if shit doesn't hit the fan.
# Note that this given sed parses the git config file globally. Make sure your subsititutions are specific enough.

Keybase proof

I hereby claim:

  • I am whilei on github.
  • I am isaacardis (https://keybase.io/isaacardis) on keybase.
  • I have a public key whose fingerprint is C6D5 ED06 A932 3F4E 0889 B265 7130 F47A 206E 470C

To claim this, I am signing this object: