Skip to content

Instantly share code, notes, and snippets.

View kohgpat's full-sized avatar
🤖
...

Nikolay Burlov kohgpat

🤖
...
  • Russia, Siberia
View GitHub Profile
# Utility commands surrounding Hubot uptime.
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.hear /hubot (who|where) are you\??/i, (msg) ->
msg.finish()
child = spawn('/bin/sh', ['-c', "echo I\\'m $LOGNAME@$(hostname):$(pwd) \\($(git rev-parse HEAD)\\)"])
child.stdout.on 'data', (data) ->
msg.send "#{data.toString().trim()} running node #{process.version} [version: #{robot.version}, pid: #{process.pid}, name: #{robot.name} ]"
@kohgpat
kohgpat / caveatPatchor.js
Created October 4, 2012 02:11 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@kohgpat
kohgpat / gist:3847026
Created October 7, 2012 03:44 — forked from jamiehodge/gist:1327195
Warden and Sinatra example
require 'sinatra/base'
require 'rack/flash'
require 'warden'
require 'slim'
require 'sequel'
require 'sqlite3'
DB = Sequel.sqlite
DB.create_table :users do
primary_key :id
user jessed staff;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
@kohgpat
kohgpat / gist:3993186
Created November 1, 2012 11:47 — forked from stepantubanov/gist:3993184
vim 7.3
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
tar -xf vim-7.3.tar.bz2
cd vim73
./configure --prefix=/usr/local --without-x --disable-nls --with-tlib=ncurses --enable-multibyte --enable-rubyinterp --enable-pythoninterp --with-features=huge --enable-gui=gnome2
make
sudo make install
sudo ln -f /usr/local/bin/vim /usr/local/bin/vi
@kohgpat
kohgpat / Rakefile
Created November 13, 2012 13:10
Sequel Rake tasks for a Sinatra app
# change foo to your library name
# change Foo::Database to your Sequel database
namespace :bundler do
task :setup do
require 'rubygems'
require 'bundler/setup'
end
end
@kohgpat
kohgpat / default.vcl.pl
Created November 30, 2012 06:48 — forked from bmarini/default.vcl.pl
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
/*
This document has been created with Marked.app <http://markedapp.com>, Copyright 2011 Brett Terpstra
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Upstanding Citizen by Brett Terpstra
Non-standard fonts used:
* OSPDIN
* League Gothic
* Fjord
* Inconsolata

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results