Skip to content

Instantly share code, notes, and snippets.

@ghoppe
ghoppe / install-mysql-0.5.6.sh
Last active August 23, 2024 17:04
Install mysql on MacOS with brew
gem install mysql2 -v '0.5.6' -- --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config --with-ldflags="-L$(brew --prefix zstd)/lib -L$(brew --prefix openssl)/lib" --with-cppflags=-I$(brew --prefix openssl)/include
# -*- coding: utf-8 -*-
import click
import os
import pandas as pd
def file_split(file):
s = file.split('.')
name = '.'.join(s[:-1]) # get directory name
@ghoppe
ghoppe / letsencrypt_notes.sh
Last active January 17, 2021 22:34 — forked from Greelan/letsencrypt_notes.sh
Set up Let’s Encrypt certificate using acme.sh as non-root user
# How to use acme.sh to set up Let's Encrypt, with the script being run
# mostly without root permissions
# See https://github.com/Neilpang/acme.sh for more
# These instructions use the domain "EXAMPLE.COM" as an example
# These instructions:
# - work on Ubuntu 18.04 and 20.04 with nginx
# - use CloudFlare DNS validation
@ghoppe
ghoppe / update_column_sql
Created May 1, 2020 03:17
mySQL Update a column in selection
UPDATE table1 as t,
(
SELECT id, a, b
FROM table1
WHERE a = 9 AND b < 357
) as temp
SET t.a = 22 WHERE temp.id = t.id;
@ghoppe
ghoppe / $
Created April 30, 2020 19:24
macOS Screen Sharing with SSH tunnelling
ssh -f <<name>> -N
@ghoppe
ghoppe / update_cache_counters.rake
Created July 24, 2018 17:10 — forked from joost/update_cache_counters.rake
Rails Rake Task: Update all cache counters / counter caches.
# More robust version to update new or existing counter cache columns in your Rails app.
# See: https://gist.github.com/svyatov/4225663
desc 'Update all cache counters'
task :update_cache_counters => :environment do
models_to_update = {}
# or: Rails.application.eager_load!
# Dir loads less, so it's faster
Dir.glob(Rails.root.join('app/models/**/*')).each { |model| require model if File.file?(model) }
@ghoppe
ghoppe / photolink.js
Last active June 28, 2021 19:37
Javascript code to help in linking images to part numbers. Prerequisites: Jquery, semantic-ui, alasql
@ghoppe
ghoppe / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Created February 19, 2016 19:18 — forked from ccstone/BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEDIT/TEXTWRANGLER REGULAR EXPRESSION GUIDE MODIFIED 2014-01-13 : 00:12
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
bundle config local.gem_name ~/Projects/gems/gem_name
bundle config --delete local.gem_name
@ghoppe
ghoppe / Gemfile
Last active August 29, 2015 14:10
Transfer development sqlite3 database to Openshift postgres
source 'https://rubygems.org'
gem 'rack','1.0.1'
gem 'taps'
gem 'sqlite3'
gem 'pg'