Skip to content

Instantly share code, notes, and snippets.

Avatar

inoas

View GitHub Profile
@inoas
inoas / deploy.yml
Created Nov 23, 2020 — forked from tfwright/deploy.yml
Ansible Phoenix deployment playbook
View deploy.yml
---
# ansible 2.9.0
- name: Deploy to production
hosts: production
remote_user: user
vars:
app_root: /home/user/apps/my_app
tasks:
@inoas
inoas / mysql-levenshtein.sql
Created Nov 25, 2019 — forked from Kovah/mysql-levenshtein.sql
Levenshtein function for MySQL
View mysql-levenshtein.sql
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@inoas
inoas / brew-maintain
Created Aug 7, 2018
~/bin/brew-maintain
View brew-maintain
#!/bin/bash
echo 'brew...' \
&& echo '• update' \
&& brew update \
&& echo '• upgrade' \
&& brew upgrade \
&& echo '• cleanup' \
&& brew cleanup \
&& echo '• prune' \
&& brew prune \
@inoas
inoas / 00_OSX_Docker_Machine_Setup.md
Created Jul 27, 2018 — forked from bitjockey42/00_OSX_Docker_Machine_Setup.md
Use native virtualization on OS X docker with xhyve
View 00_OSX_Docker_Machine_Setup.md

What this?

So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.

No more dealing with virtualbox shenanigans!

In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.

Requirements

@inoas
inoas / .htaccess
Created May 24, 2018 — forked from cronfy/.htaccess
.htaccess 503 Техническое обслуживание сайта (maintenance page)
View .htaccess
AddDefaultCharset utf-8
ErrorDocument 503 /maintenance.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !maintenance.html
RewriteRule .* /maintenance.html [R=503,L]
@inoas
inoas / .htaccess
Created May 24, 2018 — forked from donnykurnia/.htaccess
.htaccess for 503 maintenance page
View .htaccess
ErrorDocument 503 /index.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [R=503,L]
@inoas
inoas / stripNamespaceFromClassName.php
Created Mar 2, 2018 — forked from jasondmoss/stripNamespaceFromClassName.php
Strip the namespace from the class to get the actual class name
View stripNamespaceFromClassName.php
<?php
/**
* Strip the namespace from the class to get the actual class name
*
* @param string $obj Class name with full namespace
*
* @return string
* @access public
*/
@inoas
inoas / object-watch.js
Created Jan 16, 2018 — forked from flackjap/object-watch.js
Fork of object.watch polyfill in ES5. Modified to not react when the value set is the same as previous.
View object-watch.js
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
*
* Modified by Nenad Damnjanović
* Nov 9, 2014
@inoas
inoas / clean-install-high-sierra-apfs.md
Created Dec 21, 2017 — forked from galderz/clean-install-high-sierra-apfs.md
How To Clean Install High Sierra on APFS-formatted main HD
View clean-install-high-sierra-apfs.md

Clean Install High Sierra on APFS-formatted main HD

Installation Steps

  1. From 10.11 or 10.12 systems, format an external hard drive with at least 500gb with "Mac Os Extended Journaled".
  2. Download High Sierra Beta and install it in the external hard drive.
  3. When the system reboots and finishes installation, it will boot from the external HD. Go to Preferences and change Startup Disk to be main HD.
  4. Reboot and press Option key when the computer makes a beep and select external HD to boot from it.
  5. Once booted again into external HD, format main HD to be APFS.
@inoas
inoas / .htaccess
Created Dec 4, 2017 — forked from ludo237/.htaccess
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
View .htaccess
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
You can’t perform that action at this time.