Skip to content

Instantly share code, notes, and snippets.

@kirillshevch
kirillshevch / rails_new_options_help.md
Last active April 28, 2024 02:27
List of "rails new" options to generate a new Rails 7 application

Run rails new --help to see all of the options you can use to create a new Rails application:

Output for Rails 7+

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
@kirillshevch
kirillshevch / telegram_animated_sticker_ffmpeg.md
Last active April 21, 2024 15:13
How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)

How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)

ffmpeg -y -i input.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -vf 'scale=512:512:force_original_aspect_ratio=decrease' output.webm

Here is a breakdown of the options:

-y - Overwrite the output file if it already exists.

Fix created timestamps after downloading from Amazon Photos

def adjust_metadata(folder_path)
  pattern = /(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}_\d{3})\.\w+$/

  Dir.foreach(folder_path) do |file|
    next if file == '.' || file == '..'

 match = file.match(pattern)
file, err := os.Create("output.txt")
if err != nil {
log.Fatalf("Failed to create file: %s", err)
}
defer file.Close()
for key, value := range files {
line := fmt.Sprintf("%s: %s\n", key, value)
_, err := file.WriteString(line)
if err != nil {
(() => {
// config:
const likea = true // like all (skip next two if true)
const tsize = 128 // minimal amount of letters in bio
const regex = /no fwb/i // dislike if found
const likes = 1000 // maximal likes per run
const speed = 1 // timeout to let it be preloaded
const timeo = 51 // timeout to let bio be loaded
const msgtm = 200 // timeout on match
// ^
# State interface
class TrafficLightState
def change_state(_traffic_light)
raise 'This method should be implemented in a subclass'
end
def display_color
raise 'This method should be implemented in a subclass'
end
end
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: review.proto
package storage
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
package main
import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
)
func main() {
package main
import (
"context"
"fmt"
"protobuftest/storage"
"github.com/go-redis/redis/v8"
"google.golang.org/protobuf/proto"
)
machine:
ruby:
version: 2.3.4
deployment:
staging:
branch: staging
commands:
- bundle exec cap staging deploy
production:
branch: production