Skip to content

Instantly share code, notes, and snippets.

@ryantology
ryantology / upgrade-mysql-mamp.sh
Last active July 18, 2017 03:19 — forked from dj1020/migrate.sh
Upgrade MAMP 4.0 to Mysql 5.7
#!/bin/sh
FILE='mysql-5.7.16-osx10.11-x86_64.tar.gz'
# MySQL direct is typically VERY slow. This uses a mirror. You can change the file source here.
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/$file
wget http://mysql.he.net/Downloads/MySQL-5.7/$FILE
#Signature from http://dev.mysql.com/downloads/mysql/
signature='e8c10d4600fc42bf8e111246982a57f4'
match=`md5 -q $FILE`
@ryantology
ryantology / README.md
Last active July 7, 2016 02:26 — forked from benschwarz/README.md
Intercom CSP (Content security policy)

You'll need to add a whole slew of hosts for intercom if you've got CSP in place (which you should).

Heres what you'll need to add (updated from intercom support request):

connect-src:
    api.intercom.io
    api-iam.intercom.io
    api-ping.intercom.io
 nexus-websocket-a.intercom.io
@ryantology
ryantology / install-keys.sh
Last active December 6, 2018 19:18 — forked from codeslinger/gist:3494
Retrieve SSH public keys from GitHub and install to authorized_keys.
#!/bin/bash
# vim:set ts=4 sw=4 et ai:
# Retrieve SSH public keys from GitHub and install to authorized_keys.
GITHUB_USERS=(USER1 USER2)
INSTALL_FILE=/home/USER/.ssh/authorized_keys
TMP_KEY=/tmp/ssh.key
CURL=/usr/bin/curl
CURLOPTS="--retry 3 --retry-delay 2 --silent --fail -o $TMP_KEY"
MS Word smart quote: Projet d’apprentissage, la présentation d’idée doit être faite au nom d’un organisme
VS Straight Quotes: Projet d'apprentissage, la présentation d'idée doit être faite au nom d'un organisme
@ryantology
ryantology / routes.php
Last active August 29, 2015 13:58
Laravel Admin Routing
<?php
// routes.php
Route::group(array('before' => 'check_auth', 'prefix' => 'admin', 'namespace' => 'Admin'), function() {
Route::resource('ideas', 'IdeasController');
});
// app/Controllers/Admin/IdeasController.php
namespace Admin;
class IdeasController extends \IdeasController {
### Keybase proof
I hereby claim:
* I am ryantology on github.
* I am ryantology (https://keybase.io/ryantology) on keybase.
* I have a public key whose fingerprint is FF9D 7C56 0875 58A4 BB45 B935 A1DD B652 4A1F 4255
To claim this, I am signing this object:
@ryantology
ryantology / hipchat-notify.js
Last active December 28, 2015 20:29
MineCraft + HipChat notification though nodejs. This is a quick little snippet that will let people in your hipchat server know that users have joined the minecraft server. Not sure what happens when the log file rotates.
Tail = require('tail').Tail;
tail = new Tail("latest.log");
HipChatClient = require('node-hipchat')
hipchat = new HipChatClient("*************************");
var loginPattern = /.*\[Server thread\/INFO\]: (.*) joined the game/;
tail.on("line", function(data) {
var loginMatch = data.match(loginPattern);
@ryantology
ryantology / gist:4248434
Created December 10, 2012 04:50
redmine 2.1 cookie error
Environment:
Redmine version 2.1.4.stable.10973
Ruby version 1.8.7 (i486-linux)
Rails version 3.2.8
Environment production
Database adapter MySQL
Redmine plugins:
no plugin installed
NoMethodError (cannot parse Cookie header: undefined method `size' for nil:NilClass):
# Intended Query
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "intel",
"fields": [
"Name^5",
@ryantology
ryantology / snatch.php
Created August 14, 2012 18:02
Grab embed id for youtube / vimeo videos
<?php if (preg_match('/http:\/\/www.youtube.com\/watch.*/', $this->request->data['Upload']['embed'], $matches)) {
parse_str(parse_url($this->request->data['Upload']['embed'],PHP_URL_QUERY),$vars);
$videoid = $vars['v'];
if (!$videoid) { break; }
$this->request->data['Upload']['type'] = 'youtube';
$this->request->data['Upload']['attribution'] = $videoid;
$videoThumb = $this->_getThumbYoutube($videoid);
}
if (preg_match('/http:\/\/(www\.)?vimeo.com\/(\d+)/', $this->request->data['Upload']['embed'], $matches)) {
$videoid = $matches[2];