Skip to content

Instantly share code, notes, and snippets.

Avatar

Виктор Диктор Rpsl

View GitHub Profile
View disable_console
(function() {
try {
var $_console$$ = console;
Object.defineProperty(window, "console", {
get: function() {
if ($_console$$._commandLineAPI)
throw "Sorry, for security reasons, the script console is deactivated on netflix.com";
return $_console$$
},
set: function($val$$) {
@Rpsl
Rpsl / twig_str2javascript_helper.php
Created Sep 3, 2012
Twig filter "String 2 Javascript"
View twig_str2javascript_helper.php
<?php
/**
* Вывод текста через javascript, чтобы он не индексировался поисковиками.
*
* @param $str
* @return string|bool
*/
function str2javascript( $str = FALSE )
{
@Rpsl
Rpsl / gist:3689563
Created Sep 10, 2012
PHP check zombie process
View gist:3689563
<?php
//Проверка на зависший процесс
$pid = '/tmp/filestart.pid';
$timeout = 3 * 60 * 60;
if ( is_file( $pid ) )
{
$pidInfo = explode( '|', file_get_contents( $pid ) );
if ( isset( $pidInfo[1] ) AND $pidInfo[1] + $timeout > time() )
{
@Rpsl
Rpsl / index.js
Created Dec 29, 2015
node js stream soundcloud to airplay
View index.js
var browser = require('airplay').createBrowser(2);
var resolve = require('soundcloud-resolve');
browser.on('deviceOnline', function(device) {
console.log('device online: ' + device.id);
if(device.info_.name == 'SysadmTV') {
console.log(device)
@Rpsl
Rpsl / img_optim.sh
Created Jun 11, 2014
Image Optimize
View img_optim.sh
for file in `find . -iname "*.jpg" -or -iname "*.png" -or -iname "*.jpeg"`;do
ext=${file##*.}
if [ -n "$ext" ]; then
if [ "$ext" = "jpg" ]; then
echo "optimizing ${file} as jpeg file with jpegtran"
jpegtran -copy none -optimize -perfect -outfile temp_abracadabra_filename.jpg $file
mv -f temp_abracadabra_filename.jpg $file;
fi
if [ "$ext" = "jpeg" ]; then
echo "optimizing ${file} as jpeg file with jpegtran"
View keybase.md

Keybase proof

I hereby claim:

  • I am rpsl on github.
  • I am rpsl (https://keybase.io/rpsl) on keybase.
  • I have a public key ASBdGqf_liiGzgSryz2XNzvKm2m7yF4iSP0EenvLaIr-Dgo

To claim this, I am signing this object:

View gist:f2e38373d59ac24cda296ac73bda31af
brew install aspell --with-lang-ru
mkdir -p ~/your-work-directory/aspell && aspell -l ru dump master | aspell -l ru expand | tr ' ' '\n' > ~/your-work-directory/aspell/russian.dic
Затем в IDE: Settings->Editor->Spelling->Dictionaries->Custom Dictionaries
Добавляем ~/your-work-directory/aspell
@Rpsl
Rpsl / commit-msg
Last active Dec 16, 2016
Check commit msg before commit
View commit-msg
#!/usr/bin/env python
# Install:
# cp ./.git/hooks/commit-msg ./.git/hooks/commit-msg.old 2>/dev/null; curl https://gist.githubusercontent.com/Rpsl/4dabaa7120f8a5e08b918a6171aef832/raw > ./.git/hooks/commit-msg && chmod +x ./.git/hooks/commit-msg
import sys
import os
import re
from subprocess import check_output
@Rpsl
Rpsl / apps.scpt
Created Nov 26, 2015
A little script to gather any application windows that are partially offscreen in some way and shift them back to the desktop. This is particularly useful if you use a MacBook with an external display.
View apps.scpt
tell application "Finder"
-- get desktop dimensions (dw = desktop width; dh = desktop height)
set db to bounds of window of desktop
set {dw, dh} to {item 3 of db, item 4 of db}
end tell
tell application "System Events"
repeat with proc in application processes
tell proc
repeat with win in windows
@Rpsl
Rpsl / readme.md
Last active May 26, 2017
Техническое писательство
View readme.md

Техническое писательство:

code

Общие принципы

Технический писатель (англ. technical writer, technical author) — специалист, занимающийся документированием в рамках решения технических задач, в частности разработки программного обеспечения. wiki

Отсюда следует основное отличие технического писателя от обычного писателя - он умеет лаконично и ёмко выражать свои мысли.