Skip to content

Instantly share code, notes, and snippets.

@popstas
popstas / git.home.popstas.ru.conf
Last active May 20, 2018 22:24
nginx-site configs
server {
listen 443 ssl http2;
server_name git.home.popstas.ru;
access_log off;
ssl_certificate /etc/letsencrypt/live/git.home.popstas.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.home.popstas.ru/privkey.pem;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
location / {
proxy_pass http://localhost:10080;
proxy_set_header Host $http_host;
list_terms (){
uuids=$(gsettings get org.gnome.Terminal.ProfilesList list | tr -d \' | tr -d \[ | tr -d \] | tr -d ,)
for uuid in $(echo $uuids); do
gsettings get org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${uuid}/ visible-name | tr -d \'
done
}
select_term (){
selected="$(list_terms | sort -n | fzf)"
if [ -n "$selected" ]; then
@popstas
popstas / sa-core-2018-drupal-older-7.35.patch
Created April 26, 2018 05:50
SA-CORE-2018-004 for Drupal 7.34 or older
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 06acf93..d5963a0 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2778,6 +2778,31 @@ function _drupal_bootstrap_variables() {
// Load bootstrap modules.
require_once DRUPAL_ROOT . '/includes/module.inc';
module_load_all(TRUE);
+
+ // Sanitize the destination parameter (which is often used for redirects) to
@popstas
popstas / media_buttons.ahk
Last active March 21, 2018 15:33 — forked from VitalyKondratiev/media_buttons.ahk
Управление воспроизведением с клавиатуры ( AutoHotkey)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
+^!End::Send {Media_Play_Pause}
+^!Left::Send {Media_Prev}
+^!Right::Send {Media_Next}
+^!Down::Send {Volume_Down}
+^!Up::Send {Volume_Up}
@popstas
popstas / ubuntu-preseed.txt
Last active October 11, 2017 18:28
ubuntu-preseed.txt
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
choose-mirror-bin mirror/http/proxy string
d-i debian-installer/language string en
d-i debian-installer/country string RU
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
popstas@popstas-home:~/projects/_temp% sysbench --test=fileio prepare && sysbench --test=fileio --file-test-mode=rndrw run && sysbench --test=fileio cleanup

WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.7 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
---
- hosts: localhost
remote_user: popstas
roles:
- { name: viasite-ansible.zsh, zsh_user: popstas }
@popstas
popstas / phpstorm-eap-update.sh
Last active March 12, 2017 22:14
Updates PhpStorm EAP on Mac OS (don't work from PhpStorm 2016.1.1) - http://blog.popstas.ru/blog/2016/01/17/automacic-update-phpstorm-eap-on-mac-os/
#!/bin/bash
# blog post (rus) - http://blog.popstas.ru/blog/2016/01/17/automacic-update-phpstorm-eap-on-mac-os/
# usage: just run it!
set -euo pipefail
get_phpstorm_url() {
download_page="https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program"
url=$(curl -s "$download_page" | grep -oE "http:\/\/[a-zA-Z0-9\.\/-]+\.dmg")
echo "$url"
'use strict';
var argv = require('yargs').argv;
var autoprefixer = require('autoprefixer');
var cleanCSS = require('gulp-clean-css');
var concat = require('gulp-concat');
var debug = require('gulp-debug');
var duration = require('gulp-duration');
var gulp = require('gulp');
var gulpif = require('gulp-if');
@popstas
popstas / average.sh
Created February 28, 2016 22:53
Measure average script time execution
#!/bin/bash
set -eu
if [ "$#" != 1 ] && [ "$#" != 2 ]; then
echo "Usage:
# run 'command' with 5 cycles
average 'command'
# run 'command' with 3 cycles