Skip to content

Instantly share code, notes, and snippets.

@Matho
Matho / shinobi_ftp.md
Created June 22, 2023 17:49
Reolink camera with Shinobi FTP

I'm using Shinobi via Docker. I have Reolink Duo 2 cameras which are configured to store videos via ftp in Shinobi FTP.

I have following configuration: /data/shinobi/config$ cat conf.json

{
   "port": 8080,
   "orphanedVideoCheckMax": 1000,
   "insertOrphans": true,
@Matho
Matho / rpi_ssd.md
Created November 6, 2022 19:18
Boot from SSD connected via USB 3 on Raspberry PI 4 8GB

Boot from SSD connected via USB 3 on Raspberry PI 4 8GB

6th November 2022

I have decided to stop using microSD cards in my Raspberry PI mini cluster. I'm afraid, that the card will fail in few months, so I have decided to switch to SSD disk. The prices are almost similar to prices of microSD cards (price of usb to ssd adapter not included).

In my cluster, I'm using Ubuntu 20.04. Ubuntu 20.04 was released before the EEPROM update to RPi4 which allowed USB booting. In this tutorial we will show how to prepare USB booting on Ubuntu 20.04.

Hardware

I have bought:

@Matho
Matho / refinery_ruby_3.md
Last active June 7, 2023 19:12
Refinery CMS with Rails 6.1.4 and Ruby 2.7.3 / Ruby 3.0.2

Hi

Here are instructions, how to be able run edge Refinery CMS with Rails 6.1.4 and Ruby 2.7.3 / Ruby 3.0.2

Refinery CMS with Ruby 2.7.3 and Rails 6.1.4

If you use rvmrc, like me, create gemset for Ruby 2.7.3

$ vim .rvmrc 
rvm use ruby-2.7.3@refinerycms-sample4 --create 
@Matho
Matho / Gemfile
Created March 31, 2020 07:43
Plyr player with hls quality switcher
gem 'plyr-rails', '3.5.10', github: 'Matho/plyr-rails', ref: '18cb2108b'
gem 'curb'
gem 'm3u8'
@Matho
Matho / jquery-tokens-custom-tokens
Last active December 18, 2015 17:50 — forked from henkm/gist:952240
Jquery Tokens - custom tokens on the fly
Use this fork https://github.com/kusmierz/jquery-tokeninput/
See this discussion about idea http://railscasts.com/episodes/258-token-fields?view=comments#comment_152978
#model (idea 100% stolen from ryanb)
def author_tokens=(ids)
ids.gsub!(/CREATE_(.+?)_END/) do
Author.create!(:name => $1).id
end
self.author_ids = ids.split(",")
@Matho
Matho / gist:4389818
Created December 27, 2012 16:53
TinyMCE settings for Word html cleaning, preserving text color
// Paste in http://fiddle.tinymce.com/baaaab
// This settings strip all span and font tag, but preserving color and text-decoration
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
@Matho
Matho / refinerycms_submenu
Created September 15, 2012 08:58
Refinery CMS 2.0.x - rendering submenu
Refinery CMS 2.0.x
Rendering submenu - expanding 1 level deeper branch step-by-step
Example:
1)
- Home # Click here
- Contact
2)
- Home
@Matho
Matho / refinerycms_nginx_proxy_cache
Last active September 9, 2016 20:20
Refinery CMS - Nginx proxy_cache instead of Rack:Cache
Refinery CMS:
Caching images generated by Dragonfly with Nginx cache_proxy instead of Rack:Cache
Before:
Static image served by Nginx: 4409.40 req/sec (mean)
Dragonfly generated images from Rack:Cache: 286.66 req/sec (mean)
After:
Dragonfly generated images from Nginx proxy_cache: 4099 req/sec (mean)
@Matho
Matho / main_navigation_caching_in_refinery_cms
Created August 23, 2012 15:34
Main navigation caching in Refinery CMS
Main menu cahing in Refinery CMS >= 2.0.0
If you are in development mode, set config.action_controller.perform_caching = true in development.rb
Then create app/decorators/controllers/refinery/admin/pages_controller_decorator.rb:
# This is for main navigation fragment caching - do cache expiration after reordering pages
Refinery::Admin::PagesController.class_eval do
after_filter lambda{::Refinery::PageSweeper.instance.sweep(page)}, :only => [:update_positions]
end