Skip to content

Instantly share code, notes, and snippets.

View marcometz's full-sized avatar

Marco Metz marcometz

View GitHub Profile
@marcometz
marcometz / use - create missing city articles
Last active May 20, 2021 13:55
use metropolis - city articles
parent_article = Goldencobra::Article.create!(url_name: "cities", breadcrumb: "cities", title: "cities", article_type: "City Index")
inactive_cities = City.where(article_id: nil)
inactive_cities.each do |city|
city_article = Goldencobra::Article.new(teaser: city.title, content: "", breadcrumb: city.title, title: city.title, article_type: "City Show", parent_id: parent_article.id)
city_article.city = city
city_article.save
end
@marcometz
marcometz / inotify watchers - docker
Created December 17, 2020 08:08
increase the amount of inotify watchers
Increasing the amount of inotify watchers
If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
$ echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf
$ sysctl -p
@marcometz
marcometz / gist:410ee3f5502418ea58f53c146f5ad990
Created December 11, 2020 09:42
VS Code debugger rails launch.json
{
// Verwendet IntelliSense zum Ermitteln möglicher Attribute.
// Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
//
// https://github.com/microsoft/vscode-recipes/tree/master/debugging-Ruby-on-Rails
"version": "0.2.0",
"configurations": [
{
"name": "Rails server",
@marcometz
marcometz / .env
Last active August 13, 2020 17:19
New Rails App with Docker
DOMAIN=docker.localhost
PRODUCTION_DOMAIN=foo.bar.de
APP=appname-api
REGISTRY_URL=registry.foo.bar.de/tpwd/appname-api
NODE_ENV=development
@marcometz
marcometz / cap restart
Last active July 1, 2022 13:09
restart with capistrano and maintenance
cap production deploy
cap production maintenance:enable
cap production unicorn:stop
cap production unicorn:stop
cap production unicorn:start
cap production maintenance:disable
cap staging deploy
cap staging maintenance:enable
cap staging unicorn:stop
@marcometz
marcometz / traefik basic auth htpasswd
Last active November 27, 2023 13:42
user and password generator for traefik basic auth middleware
traefik.frontend.auth.basic.users:
echo $(htpasswd -nbB username "passwort") | sed -e s/\\$/\\$\\$/g
@marcometz
marcometz / sql url replacement
Last active June 10, 2020 07:43
sql replace url to localhost
# www.quirinprivatbank.de => localhost:3000
UPDATE goldencobra_article_urls SET url = REPLACE(url, "https://www.quirinprivatbank.de", "http://localhost:3000");
# www.quirinprivatbank.de => staging.quirincloud.dev-ikusei.de
UPDATE goldencobra_article_urls SET url = REPLACE(url, "https://www.quirinprivatbank.de", "https://staging.quirincloud.dev-ikusei.de");
@marcometz
marcometz / result_agendakonf.txt
Last active April 3, 2017 12:51
Find content in Goldencobra including "http://"
Goldencobra::Article.where("content LIKE '%http://%' OR teaser LIKE '%http://%' OR summary LIKE '%http://%' OR context_info LIKE '%http://%'").pluck(:id)
=> [3, 5, 7, 145, 146, 148, 149, 150, 152, 153, 155, 157, 158, 159, 160, 161, 162, 165, 172, 173, 232, 236]
Goldencobra::Widget.where("content LIKE '%http://%' OR mobile_content LIKE '%http://%' OR teaser LIKE '%http://%'").pluck(:id)
=> [5]
Goldencobra::Setting.where("value LIKE '%http://%'").pluck(:id)
=> [154, 158, 236]
GoldencobraEvents::EventPricegroup.where("description LIKE '%http://%' OR email_text LIKE '%http://%'").pluck(:id)
@marcometz
marcometz / create_versions.sql
Created November 15, 2013 23:06
Papertrail Versions table create
CREATE TABLE `versions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`item_type` varchar(255) NOT NULL,
`item_id` int(11) NOT NULL,
`event` varchar(255) NOT NULL,
`whodunnit` varchar(255) DEFAULT NULL,
`object` text,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_versions_on_item_type_and_item_id` (`item_type`,`item_id`)
@marcometz
marcometz / etc_init.d_unicorn_example.co.uk
Last active December 14, 2015 07:09 — forked from rubysolo/etc_init.d_unicorn_example.co.uk
Server Configuration für Ubuntu mit nginx, unicorn rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn