Skip to content

Instantly share code, notes, and snippets.

View astyagun's full-sized avatar

Anton Styagun astyagun

  • Russia
View GitHub Profile
@astyagun
astyagun / com.exclude-code-subdirectories-from-backups.plist
Created March 16, 2017 09:39
Exclude some Rails projects subdirectories from Time Machine backups to save space. Command runs on load and daily.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.exclude-code-subdirectories-from-backups</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
@astyagun
astyagun / slack-count-links
Created February 14, 2017 15:53
Counts the number of occurrences of links to most popular domains
@astyagun
astyagun / Flag Project.applescript
Created January 18, 2017 18:49
Flags or unflags project of selected action(s) in OmniFocus
(*
# DESCRIPTION #
Based on: http://bylr.net/3/2015/05/omnifocus-view-project-in-new-window/
Flags or unflags project of selected action.
# LICENSE #
Copyright © 2015 Dan Byler (contact: [email protected])
@astyagun
astyagun / VK album photo links.js
Created April 18, 2015 15:16
VK album photo links
@astyagun
astyagun / .psqlrc
Created April 13, 2015 12:18
.psqlrc
-- display how long query takes
\timing
-- how to show NULLs
\pset null null
-- disable page
\pset pager off
-- automatic extended output based on the width of the table
@astyagun
astyagun / list_locks.sql
Last active September 29, 2017 17:25
PG list locks
SELECT blocked_locks.pid AS blocked_pid,
blocked_activity.usename AS blocked_user,
blocking_locks.pid AS blocking_pid,
blocking_activity.usename AS blocking_user,
blocked_activity.query AS blocked_statement,
blocking_activity.query AS blocking_statement,
blocking_activity.query_start AS blocking_start
FROM pg_catalog.pg_locks blocked_locks
JOIN pg_catalog.pg_stat_activity blocked_activity ON blocked_activity.pid = blocked_locks.pid
JOIN pg_catalog.pg_locks blocking_locks
@astyagun
astyagun / .gitignore
Last active June 25, 2020 17:50
.gitignore
# Local configuration
/.docker.env
/.env
/.haml-lint.yml
/.yardoc
/coffeelint.json
/config/database.yml
/config/master.key
/config/secrets.yml.key
/config/settings.local.yml
@astyagun
astyagun / Launch StarCraft II.applescript
Last active December 18, 2015 05:29
AppleScript StarCraft 2 launcher that enables Function keys before the game starts and disables them again after the game quits.
to enableFunctionKeys(functionKeys)
tell application "System Preferences" to activate
tell application "System Preferences"
activate
reveal pane id "com.apple.preference.keyboard"
tell application "System Events"
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell checkbox 1 of tab group 1 of window 1 of application process "System Preferences"