Skip to content

Instantly share code, notes, and snippets.

View andxyz's full-sized avatar
:octocat:

Andrew Stevens andxyz

:octocat:
View GitHub Profile
#!/usr/bin/env ruby
require 'csv'
require 'socket'
class AverageSessionsPerServer
Server = Struct.new(:name, :current_sessions, :status) do
META_SERVER_NAMES = ['FRONTEND', 'BACKEND'].freeze
def up?
@fabiofl
fabiofl / gist:5873100
Created June 27, 2013 00:41
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@mislav
mislav / gist:5897126
Last active September 27, 2021 09:34
Low-value pull requests are worse than useless

Why do I feel insulted Re: automated bots making pull requests

An open source project is a lot of work. There are features to be built, bugs to be solved, releases to be made, documentation to be written and the inevitable support you have to provide via GitHub issues, Twitter and mailing lists.

Like anything worth doing, throughout this process there are hard problems that need to be solved. Valued contributors are ones who study the project's philosophy, understand the subject matter and are thinkers who gift their experience and time to the cause.

Therefore a person or a bot who joins in with a pull request that was a result of running a tool against the project's source code—like code linting or stripping of unnecessary whitespace—is a lowest form of contribution there is. It makes the statement: “Here, I didn't bother to see what current problems are in need of discussing/solving, so I ran a widely available script from the command-line t

@schpet
schpet / gifplease.sh
Created July 7, 2013 08:29
Turn a directory of jpegs into a gif
mogrify -format gif -resize 400 *.jpg
gifsicle --delay=20 --loop *.gif > yep.gif
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@andrewvc
andrewvc / elasticsearch.conf
Created October 3, 2013 17:05
Upstart script for elasticsearch on ubuntu.... that actually works. Install the deb, and then run `sudo update-rc.d elasticsearch remove -f` to disable the init script.
# ElasticSearch upstart script
description "ElasticSearch service"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
module Sq
class Template < Sequel::Model
one_to_many :fields
def mapped_template_ids
FieldMapping.as(:m).
join(Field.named(:f), id: :field_id, template_id: id).
join(Field.named(:mf), id: :m__mapped_field_id).
distinct.select_map(:mf__template_id)
end
@XVilka
XVilka / TrueColour.md
Last active August 19, 2025 02:09
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@hlung
hlung / How to connect PS3 controller to a Mac or PC.md
Last active May 26, 2025 14:01
How to connect PS3 controller to a Mac or PC

How to connect PS3 controller to a Mac or PC

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@scottgonzalez
scottgonzalez / pr-merge.md
Last active January 3, 2016 09:49
Landing PRs

Update master

First, make sure master is up to date.

git checkout master
git pull upstream master

Rebase your branch