Skip to content

Instantly share code, notes, and snippets.

View alishersadikov's full-sized avatar

Alisher Sadikov alishersadikov

View GitHub Profile
@squarism
squarism / iterm2.md
Last active November 14, 2024 08:35
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)

2023-01-10

Changing to iso 1806 style dates cuz who needs anything else amiright?

DISTINCT ON

DISTINCT ON with ORDER BY acts acts like window functions with ranking/row_number. https://www.youtube.com/watch?v=XuGxGP8quMQ

psql get result file workaround

-- Set the variable "query" to the contents of the sql file
\set query `cat my_rad_query.sql`
@Chocksy
Chocksy / kill_sidekiq_job.rb
Last active July 16, 2024 16:24
Kill sidekiq jobs by process id for busy jobs and by jid for other sets.
# FOR BUSY JOBS
# take the process_id from the /busy page in sidekiq and kill the longest running one.
workers = Sidekiq::Workers.new
long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a'
workers.each do |process_id, thread_id, work|
process = Sidekiq::Process.new('identity' => process_id)
process.stop! if process_id == long_process_id
end
# FOR SCHEDULED JOBS
@danott
danott / pre-commit
Last active July 23, 2024 21:51
A git hook that automatically formats JavaScript and Ruby code on commit
#!/bin/sh
# ./.git/hooks/pre-commit
.git/hooks/pre-commit-format-javascript
.git/hooks/pre-commit-format-ruby