Skip to content

Instantly share code, notes, and snippets.

View foxweb's full-sized avatar
🏠
Working from home

Aleksey Kurepin foxweb

🏠
Working from home
View GitHub Profile
This file has been truncated, but you can view the full file.
op-web | D, [2024-06-04T10:50:39.098499 #1379] DEBUG -- : [fd8d63bd-dd73-4987-a616-7b02dfb92892] User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."type" IN ($1, $2, $3, $4) AND "users"."type" NOT IN ($5, $6, $7) AND "users"."status" = $8 AND "users"."id" = $9 LIMIT $10 [["type", "User"], ["type", "SystemUser"], ["type", "DeletedUser"], ["type", "AnonymousUser"], ["type", "SystemUser"], ["type", "AnonymousUser"], ["type", "DeletedUser"], ["status", 1], ["id", 167], ["LIMIT", 1]]
op-web | D, [2024-06-04T10:50:39.100341 #1379] DEBUG -- : [fd8d63bd-dd73-4987-a616-7b02dfb92892] Setting Maximum (0.5ms) SELECT MAX("settings"."updated_at") FROM "settings"
op-web | I, [2024-06-04T10:50:39.102264 #1379] INFO -- : [fd8d63bd-dd73-4987-a616-7b02dfb92892] OpenProject User: ####### ####### (user@example.org ID: 167 <user@example.org>)
op-web | D, [2024-06-04T10:50:39.107159 #1379] DEBUG -- : [fd8d63bd-dd73-4987-a616-7b02dfb92892] Storages::Storage Load (2.6ms) SELECT "storages".* FROM "storages"
@foxweb
foxweb / sorting_photos_videos.rb
Created May 3, 2024 07:56
Sorting and ordering photos/videos from camera by directories named by date
extensions = ['*.MOV', '*.MP4', '*.JPG', '*.DNG', '*.SRT']
dir_list = Dir.glob(extensions)
dir_list.map{|f| date = File.mtime(f).strftime('%F'); Dir.mkdir(date) unless Dir.exist?(date); FileUtils.mv(f, date)}
a = [0, 1, 2, 3, 4, 5]
# example 1
def reverse(array)
array.each_with_index do |val, index|
break if index >= array.count / 2
temp = array[index]
array[index], array[-index-1] = array[-index-1], temp
end
@foxweb
foxweb / cleandir.sh
Created January 21, 2022 23:35
Removing extra files (hidden files from macOS) and files/dirs permissions fix.
#!/bin/sh
sudo chown -R foxweb:foxweb ./*
find . -name "*" -type d -print0 | xargs -0 /bin/chmod 755
find . -name "*" -type f -print0 | xargs -0 /bin/chmod 644
find . -name ".DS_Store" -type f -print0 | xargs -0 /bin/rm
find . -name "._*" -type f -print0 | xargs -0 /bin/rm
find . -name ".AppleDouble" -type d -print0 | xargs -0 /bin/rm -rf
@foxweb
foxweb / gps_parser.rb
Last active June 19, 2020 14:04
Extract GPS-coordinates from JPEG with Ruby and imagemagick
class GpsParser
def initialize(file_path)
@file_path = file_path
end
def converted_gps
return if raw_exif_data.empty?
{
latitude: float_gps(:GPSLatitude, :GPSLatitudeRef),
require 'benchmark'
n = 100_000
abc = ('A'..'Z').to_a
Benchmark.bm do |x|
x.report { n.times { rand(65..90).chr } }
x.report { n.times { rand('A'.ord..'Z'.ord).chr } }
x.report { n.times { ('A'..'Z').to_a.sample } }
x.report { n.times { abc.sample } }
Style/FrozenStringLiteralComment:
EnforcedStyle: never
Layout/AccessModifierIndentation:
EnforcedStyle: outdent
Layout/EmptyLinesAroundAccessModifier:
Enabled: false
Layout/ExtraSpacing:
swagger: '2.0'
info:
version: '1.0'
title: Nightingale API
description: Перед вами документация по Nightingale API (система управления контентом). Пока API без версионирования. Звёздочками отмечены обязательные поля. В двойных фигурных {{скобках}} указаны переменные, заданные в environment.
host: example.com
basePath: /
schemes:
- http
consumes:
2017-07-10 13:54:32 +0300: Rack app error: #<Faraday::ConnectionFailed>
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:641:in `rescue in connection_for'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:589:in `connection_for'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:in `request'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb:25:in `perform_request'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb:21:in `with_net_http_connection'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in
0x9f9263e8a207de5f4a102cfcf02ee87e463bcc4d