Skip to content

Instantly share code, notes, and snippets.

View massayoshi's full-sized avatar
👹

Flávio M. Oota massayoshi

👹
View GitHub Profile
@massayoshi
massayoshi / image-cleanup-wordpress.rb
Created June 27, 2022 22:02
Script to cleanup the different image sizes wordpress creates and just keep the original file
#!/usr/bin/ruby
pattern = /-\d+x\d+\.(jpg|png|jpeg)/ # my-file-name-pattern-2000x2000.jpg
files = Dir.glob("/path/to/wordpress/wp-content/uploads/20XX/**/*.*")
files.sort!
files.each do |file|
if pattern =~ file
@massayoshi
massayoshi / docker-compose.yml
Last active January 26, 2021 17:05
nginx config for when you are already running it by itself and also need to run a docker container. by doing this you are removing the 8080 port requirement.
version: '2'
services:
mariadb:
image: 'docker.io/bitnami/mariadb:10.3-debian-10'
volumes:
- 'mariadb_data:/bitnami/mariadb'
- ./db-dump.sql:/docker-entrypoint-initdb.d/init.sql
environment:
- MARIADB_USER=bn_wordpress
- MARIADB_DATABASE=bitnami_wordpress
@massayoshi
massayoshi / studies.scad
Last active September 15, 2016 03:00
Primeiros passos no OpenSCAD
$fn=64;
module added(){
hull(){
cube([235,60,6]);
translate([0,0,6]) cube([160,60,18]);
}
}
module taken(lb){
hull(){
translate([(160/2)+13,0,3]) cylinder(r=9, h=20);
@massayoshi
massayoshi / crontab
Last active August 29, 2015 14:06 — forked from airblade/crontab
@reboot cd /var/www/apps/myapp/current && bundle exec unicorn -c /var/www/apps/myapp/current/config/unicorn.rb -E production -D
#app/models/event.rb
class Event < ActiveRecord::Base
translates :title, :description
has_many :event_translations
accepts_nested_attributes_for :event_translations, :allow_destroy => true
end
class Controller
include LazyLoad
def show
@model = Model.find(...)
respond_to do |format|
format.html do
@html_specific_data = Model.find(...)
end