Skip to content

Instantly share code, notes, and snippets.

View rvkulikov's full-sized avatar
💭
А в душе май

Roman Kulikov rvkulikov

💭
А в душе май
  • Moscow, Russia
  • 06:41 (UTC +03:00)
View GitHub Profile
@briandignan
briandignan / save_restore_dependencies.sql
Last active April 1, 2024 02:13 — forked from claudep/save_restore_dependencies.sql
Changed types for compatibility with PG12. Added save/restore for indexes/rules
create table if not exists deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema name,
deps_view_name name,
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema name, p_view_name name) returns void as
$$
@Delivator
Delivator / lockmicvolume.ps1
Created February 7, 2019 21:13
A little powershell script that sets the default microphone volume to a set value, requires nircmd.exe to be in same directory as the script
# How long it should wait between every loop in seconds
$secondsToWait = 5
# The volume you want in percent (0.92 = 92%)
$volume = 1.00
Write-Host "Starting invinite loop, press CTRL + C or close the window to stop"
while (1) {
Start-Process -FilePath "nircmd.exe" -WorkingDirectory $PSScriptRoot -ArgumentList "setsysvolume $([math]::floor(65535 * $volume))","default_record" -Wait
Write-Host "Volume set to $($volume * 100)%"
Start-Sleep -Seconds $secondsToWait
@anvk
anvk / psql_useful_stat_queries.sql
Last active April 23, 2024 03:15
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@lkraider
lkraider / gs-resample.sh
Created March 7, 2017 20:06
Ghostscript PDF quality downsample
#!/bin/sh
# It seems it's very hard to set resample output quality with Ghostscript.
# So instead rely on `prepress` preset parameter to select a good /QFactor
# and override the options we don't want from there.
gs \
-o resampled.pdf \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/prepress \
#!/usr/bin/env python
import i3
outputs = i3.get_outputs()
workspaces = i3.get_workspaces()
# figure out what is on, and what is currently on your screen.
workspace = list(filter(lambda s: s['focused']==True, workspaces))
output = list(filter(lambda s: s['active']==True, outputs))
@mateuszwenus
mateuszwenus / save_restore_dependencies.sql
Last active April 11, 2024 05:49
PostgreSQL: How to handle table and view dependencies
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 3, 2024 16:53
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@dustyburwell
dustyburwell / youtrack_comment_icons.user.js
Created July 27, 2012 20:01
YouTrack comment icons user script
// Copyright (c) 2012, Dusty Burwell
//
// ==UserScript==
// @name Emoticons for YouTrack
// @namespace http://dustyburwell.github.com
// @description Converts text to emoticons in YouTrack.
// @include http://youtrack/*
// @include https://youtrack/*
// ==/UserScript==