Skip to content

Instantly share code, notes, and snippets.

@lfender6445
lfender6445 / gist:47a7d6e6f0e24a67ea0e
Created September 28, 2014 02:27
How to SSH when default port is blocked
If port 22 is disabled on your network (you're getting timeouts on a public wifi network) you can force ssh connections to use https instead.
On your linux server, edit `/etc/ssh/sshd_config` and find `Port 22`. Comment it out and use port 443 instead.
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
# Port 22
Port 443
@lfender6445
lfender6445 / gist:70b00c97df43827279f7
Last active September 12, 2018 07:50
Never go idle in hipchat - Disable hipchat idle when away from computer
#! /bin/bash
# This if for the mac hipchat client
# To setup, download this file to any folder and save as `hip.sh`
# change the permissions of the file so it is executable using terminal
# You can do this by running `chmod u+x ./hip.sh`
# Now you can run `./hip.sh`
echo 'Hipchat hooray...ho... - Press CTRL+C to stop'
while :
do
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
define({
// The port on which the instrumenting proxy will listen
proxyPort: 9000,
// A fully qualified URL to the Intern proxy
proxyUrl: 'http://localhost:9000/',
@lfender6445
lfender6445 / gist:b7949bbd127bf88e2d0c
Last active August 29, 2015 14:02
syslogd out of control - memory leak, osx fix

Syslogd memory leak, osx fix

syslogd out of control?

syslogd is a daemon/background process that logs and generates messages from the system. if this is eating up your CPU, you can find the offending process and kill it.

  1. Open up terminal and run tail -f /var/log/system.log. You may see some output like this, but it will be very different for you machine:

    Jun 12 11:17:08 lfender-mbp kernel[0]: *** kernel exceeded 500 log message per second limit  -  remaining messages this     second discarded ***
    

Jun 12 11:17:09 lfender-mbp kernel[0]: Data/Stack execution not permitted: ruby[pid 72771] at virtual address 0x7fbd9c078000, protections were read-write

<template name='video'>
<p align="center"><input type="button" id="share_screen" value="Share screen"/></p>
<p align="center"><video id="video" autoplay='autoplay'></video></p>
<script language="javascript">
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
$('#share_screen').click(function() {
navigator.getUserMedia({
audio: false,
video: {
@lfender6445
lfender6445 / gist:9919357
Last active March 28, 2024 08:38
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@lfender6445
lfender6445 / gist:7649335
Last active December 29, 2015 09:19
jasmine require js trickery
subject = {}
describe 'Main', ->
beforeAll = false
beforeEach ->
return if (beforeAll)
beforeAll = true;
require ['shared/main'], (main) -> subject = main
@lfender6445
lfender6445 / query_to_hash.js
Created September 25, 2013 23:55
jQuery convert query string to json
query_to_hash = function() {
var j, q;
q = window.location.search.replace(/\?/, "").split("&");
j = {};
$.each(q, function(i, arr) {
arr = arr.split('=');
return j[arr[0]] = arr[1];
});
return j;
}
@lfender6445
lfender6445 / gist:6514498
Created September 10, 2013 19:40
stress test for leads
var start, elapsed;
var load_times= [];
var init = function(){
$('body').bind('finished', function(){
elapsed = new Date() - start;
load_times.push(elapsed);
console.log("Elapsed time: " + elapsed);
});
benchmark();
@lfender6445
lfender6445 / parse_pivotal_story_from_git_branch.sh
Created September 4, 2013 16:46
OSX, pipes to pbcopy. Allows you to parse pivotal story from you current Github branch, matching first sequence of numbers in the branch.
git rev-parse --abbrev-ref HEAD | egrep -o '\d+'| head -n 1 | tr -d '\n' | pbcopy