Skip to content

Instantly share code, notes, and snippets.

gem install mysql2 -v '0.4.10' -- --with-opt-dir=$(brew --prefix openssl)
@ealden
ealden / gist:0563b52e10f5f6357a1c70dc25564e29
Last active September 4, 2019 08:58
Create MySQL Database and User
CREATE DATABASE <database>;
CREATE USER '<user>'@'<host>' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON <database>.* TO '<user>'@'<host>';
FLUSH PRIVILEGES;
@ealden
ealden / gist:bf33672f4cb221b9028ed0c4e804e148
Created June 11, 2019 02:31
Ruby install in Ubuntu 18.04 LTS
# Install dependencies as root
apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev
# Install rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
# Install ruby-build
from selenium import webdriver
import json
def search(url):
driver = webdriver.Chrome()
driver.get(url)
body = driver.find_element_by_tag_name('pre').text
data = json.loads(body)
@ealden
ealden / gist:a8849293bf96a3aed0b37fc345cb3e25
Last active October 10, 2017 22:19
Ruby install in Ubuntu 16.04 LTS
# Install dependencies as root
apt install -y git build-essential libssl-dev libreadline-dev zlib1g-dev
# Install rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
# Install ruby-build
@ealden
ealden / gist:854890100a11048cdd6cf27733bacd90
Last active May 1, 2017 07:31
Nginx reverse proxy with SSL
server {
listen 443 ssl;
server_name <server>;
root /srv/<app>/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
[2013-12-01T12:33:04+00:00] INFO: *** Chef 10.14.2 ***
[2013-12-01T12:33:04+00:00] INFO: Setting the run_list to ["recipe[chef-server]"] from JSON
[2013-12-01T12:33:04+00:00] INFO: Run List is [recipe[chef-server]]
[2013-12-01T12:33:04+00:00] INFO: Run List expands to [chef-server]
[2013-12-01T12:33:04+00:00] INFO: Starting Chef Run for precise64
[2013-12-01T12:33:04+00:00] INFO: Running start handlers
[2013-12-01T12:33:04+00:00] INFO: Start handlers complete.
[2013-12-01T12:33:04+00:00] INFO: Omnitruck download-server request: http://www.opscode.com/chef/download-server?p=ubuntu&pv=12.04&m=x86_64&v=latest&prerelease=false&nightlies=false
[2013-12-01T12:33:15+00:00] INFO: Downloading chef-server package from: http://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.8-1.ubuntu.12.04_amd64.deb
@ealden
ealden / gist:6154056
Last active December 20, 2015 15:29
OS X Customizations
# Always show tab bar in Terminal.app
defaults write com.Apple.Terminal ShowTabBar 1
# Always show tab bar in Safari
defaults write com.apple.Safari AlwaysShowTabBar 1
SELECT s.inst_id,
s.sid,
s.serial#,
p.spid,
s.username,
s.program
FROM gv$session s
JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE s.type != 'BACKGROUND';
@ealden
ealden / gist:3877924
Created October 12, 2012 08:10
DefaultResponseError
public void handleError(ClientHttpResponse response) throws IOException {
HttpStatus statusCode = response.getStatusCode();
byte[] body = getResponseBody(response);
if ((statusCode.series() == CLIENT_ERROR) && (body.length == 0)) {
super.handleError(response);
}
}