Skip to content

Instantly share code, notes, and snippets.

View uladar's full-sized avatar

Vlad Ro uladar

View GitHub Profile
@uladar
uladar / what_i_serialize.rb
Created August 22, 2024 18:49 — forked from crawler/what_i_serialize.rb
WHAT I SERIALIZE?
# frozen_string_literal: true
###############################################################################################
# WHAT I SERIALIZE? #
###############################################################################################
# This scrip can help you to find what object types you need to witelist after CVE-2022-32224 update
# AD: If you using StimulusJS then checkout my gem stimulus_tag_helper
# https://rubygems.org/gems/stimulus_tag_helper
# https://github.com/crawler/stimulus_tag_helper
<!-- solution 1, 117b, inspired by http://www.p01.org/releases/140bytes_music_softSynth/ -->
<button onclick="new Audio('data:audio/wav;base64,UklGRl9vT19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YU'+Array(1e3).join(123)).play()">Beep</button>
<!-- Solution 2, 107b, inspired by http://xem.github.io/chip8/c8.html -->
<button onclick="o=(A=new AudioContext()).createOscillator();o.connect(A.destination);o.start(0);setTimeout('o.stop(0)',500)">Boop</button>
@uladar
uladar / rails-jsonb-queries
Created November 10, 2022 15:08 — forked from mankind/rails-jsonb-queries
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@uladar
uladar / mysql2-catalina.md
Created November 14, 2021 19:09 — forked from fernandoaleman/mysql2-catalina.md
Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
@uladar
uladar / gist:c1329922cef1064e23adef6df4dea487
Last active September 29, 2021 11:17
1.9.3 fails to use libyaml or zlib, unable to install bundler
brew --prefix zlib
brew --prefix [email protected]
brew --prefix libyaml
/usr/local/Cellar/zlib/1.2.11
/usr/local/opt/[email protected]
/usr/local/opt/libyaml
➜ fpr git:(master) ✗
export CFLAGS="-Wno-error=implicit-function-declaration"
@uladar
uladar / my.cnf
Created March 3, 2020 22:32 — forked from rohityadavcloud/my.cnf
Example MySQL my.cnf optimized
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
@uladar
uladar / database.yml
Created March 3, 2020 22:00 — forked from gullitmiranda/database.yml
ruby DATABASE_URL parse
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
@uladar
uladar / MySQL_5-7_macOS.md
Last active February 25, 2020 21:54 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/operatino/392614486ce4421063b9dece4dfe6c21, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Catalina 10.15 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode as part of the installation process.
@uladar
uladar / git-tag-ordered-by-date
Last active January 21, 2020 20:40
git tag order chronologically
$ git tag --sort=taggerdate
$ git tag --sort=-taggerdate
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp3 output.mp4
$ ffmpeg -i input -c:v libx265 -acodec aac output.mp4
$ ffmpeg -i input -c:v libx265 -c:a copy output.mp4