Skip to content

Instantly share code, notes, and snippets.

View deivinsontejeda's full-sized avatar
🎯

Deivinson Tejeda deivinsontejeda

🎯
  • Santiago of Chile
View GitHub Profile
#!/bin/bash
# inspired from: https://gist.github.com/vitobotta/2783513
threshold=300 # after 5min of uptime, a job is considered 'stuck', to kill
logfile=log/dead_workers_killed.log
function ps_etime_to_seconds() # cheers user000001 - http://stackoverflow.com/questions/14652445/parse-ps-etime-output-into-seconds#14653443
{
echo $1 | awk -F $':' -f <(cat - <<-'EOF'
@thelibrarian
thelibrarian / Fixing XCode Command Line Tools.md
Last active November 6, 2017 03:28
How to fix compile errors with the XCode command line tools on Mac OS X. Solves problems such as failing to find Framework header files (e.g. ruby.h).

The Problem

If you have installed the standalone Command Line Tools for XCode on your Mac (i.e. without having XCode.app installed), some of these tools can get a bit confused due to a couple of oversights on Apple's part in finalising the setup.

Note: all commands below will need to be run from an Administrator account, or by an account with appropriate permission in /etc/sudoers.

The Solution

1. Failing to Find Frameworks

Sometime when compiling against the preinstalled Frameworks (e.g. Ruby or Python), various tools will inexplicable fail to find header files that are quite clearly there. This is caused by the fact that no XCode has been selected for the command-line tools. Wait, I hear you cry, I don't have XCode installed! Indeed, but you nonetheless need to select one, and point it somewhere where the command line tools exist, like so

@shu0115
shu0115 / file0.txt
Created February 25, 2013 06:19
Ruby 2.0.0-p0インストール(Mac OS X 10.8.2) ref: http://qiita.com/items/a24d1c8a1539f858137b
brew uninstall openssl
brew uninstall curl-ca-bundle
brew uninstall readline
@bf4
bf4 / ruby_learning.md
Last active July 17, 2021 08:06
Some Ruby Learning Resources
var client = bayeux.getClient()
, channelKeyPrefix = "room:";
bayeux.bind('subscribe', function(clientId, channel){
redisClient.incr(channelKeyPrefix + channel, function(error, value){
client.publish(channel, {
event: 'user-change',
params: {
onlineUsers: value
}
@rweald
rweald / simple-linear-regression.rb
Created August 29, 2012 19:13
Simple Linear Regression in Ruby
class SimpleLinearRegression
def initialize(xs, ys)
@xs, @ys = xs, ys
if @xs.length != @ys.length
raise "Unbalanced data. xs need to be same length as ys"
end
end
def y_intercept
mean(@ys) - (slope * mean(@xs))
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
anonymous
anonymous / hammer
Created March 1, 2012 07:16
hammer prototype
#!/usr/bin/env ruby
# -*- encoding: UTF-8 -*-
# Derived from <http://stackoverflow.com/questions/5663519/namespacing-thor-commands-in-a-standalone-ruby-executable>
require 'rubygems'
require 'thor'
require 'thor/group'
module Hammer