Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View inoas's full-sized avatar
🏠
Working from home

inoas

🏠
Working from home
View GitHub Profile
@Kovah
Kovah / mysql-levenshtein.sql
Created February 22, 2017 21:29
Levenshtein function for MySQL
-- 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)
@cronfy
cronfy / .htaccess
Last active July 23, 2021 19:44 — forked from donnykurnia/.htaccess
.htaccess 503 Техническое обслуживание сайта (maintenance page)
AddDefaultCharset utf-8
ErrorDocument 503 /maintenance.html
RewriteEngine On
RewriteBase /
# uncomment and set your ip to allow your ip to enter
#RewriteCond %{REMOTE_ADDR} !1\.2\.3\.4
# block requests to site, but allow let's encypt generation
@nathanl
nathanl / postgresql_serializable_isolation.sql
Last active July 15, 2022 14:11
PostgreSQL Serializable Isolation - false positives
-- (This code was run in PostgreSQL 9.6.1)
-- Demonstration of how serializable isolation for PostgreSQL, which detects possible
-- interference between concurrent transactions, can produce false positives
-- in psql, create the following table
CREATE TABLE users(
id SERIAL NOT NULL PRIMARY KEY,
username VARCHAR NOT NULL
);
@bitjockey42
bitjockey42 / 00_OSX_Docker_Machine_Setup.md
Last active November 9, 2020 13:49 — forked from andystanton/Start up local Docker Machine on OSX automatically.md
Use native virtualization on OS X docker with xhyve

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

@jaibeee
jaibeee / brew-perms.sh
Last active February 15, 2024 22:49
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
@nkbt
nkbt / .eslintrc.js
Last active April 23, 2024 03:19
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@flackjap
flackjap / object-watch.js
Last active November 8, 2019 06:40 — forked from eligrey/object-watch.js
Fork of object.watch polyfill in ES5. Modified to not react when the value set is the same as previous.
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
*
* Modified by Nenad Damnjanović
* Nov 9, 2014
@maxwelleite
maxwelleite / ttf-vista-fonts-installer.sh
Last active April 4, 2024 20:14
Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros
#!/bin/bash
# Author: Maxwel Leite
# Website: http://needforbits.wordpress.com/
# Description: Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros
# Microsoft added a group of new "ClearType Fonts" to Windows with Windows Vista and Office 2007.
# These fonts are named Constantia, Corbel, Calibri, Cambria (and Cambria Math), Candara, and Consolas.
# Calibri became the default font on Microsoft Word 2007, and it’s still the default font on Word 2016 today.
# Dependencies: wget, fontforge and cabextract
# Note: Microsoft no longer provides the PowerPoint Viewer 2007 (v12.0.4518.1014) or any version anymore for download
# Tested: Ubuntu Saucy/Trusty/Xenial/Bionic
@kkemple
kkemple / fontStacks.css
Last active January 24, 2019 12:56
Font Stacks with all browser based fonts
/* Times New Roman-based stack */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* Modern Georgia-based serif stack */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
/* Traditional Garamond-based serif stack */
font-family: "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif;
/* Helvetica/Arial-based sans serif stack */
@jasondmoss
jasondmoss / stripNamespaceFromClassName.php
Last active February 18, 2021 00:06
Strip the namespace from the class to get the actual class name
<?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
*/