Skip to content

Instantly share code, notes, and snippets.

@shtrih
shtrih / my-proxy.pac
Last active September 14, 2015 11:03
PAC for TunnelSwitch
function FindProxyForURL(url, host)
{
url = url.toLowerCase();
host = host.toLowerCase();
// whole site
var site_list = [
'local',
'lcl',
'localhost'
@shtrih
shtrih / slack-ignorer.user.js
Last active November 18, 2016 23:35
Add users to ignore list in channels. One separated black list for each channel.
// ==UserScript==
// @name Slack Ignore List (19.11.16)
// @namespace https://gist.github.com/shtrih/be922d9229925bb52617
// @version 1.4
// @description Add blacklists to channels
// @author shtrih
// @match https://*.slack.com/messages/*/
// @grant none
// ==/UserScript==
/* jshint -W097 */
@shtrih
shtrih / EmbedAV.plugin.js
Last active October 16, 2018 11:34
[Outdated since this is built in feature] Plugin for BetterDiscord. Creates player for audio and video files (mp3, mp4, webm etc.). Works only for https links. Screenshot in comments
//META{"name":"EmbedAV"}*//
/*
Check for Updates: https://gist.github.com/shtrih/8a72a36d513ec704c7a9
How to install:
1. If you don't have it, get Discord from https://discordapp.com/apps
2. Download BetterDiscord for your platform on https://betterdiscord.net/home
3. Push the button «Raw» then Ctrl + S.
3. Place the plugin in %appdata%\BetterDiscord\plugins\.
4. Refresh Discord with Ctrl + Shift + R or just restart Discord completely.
@shtrih
shtrih / CollapsibleEmbeds.plugin.js
Last active August 22, 2021 08:55
[Outdated] Plugin for BetterDiscord. Creates caret to hide image/video previews.
//META{"name":"CollapsibleEmbeds"}*//
/*
Check for Updates: https://gist.github.com/shtrih/59a8be1f9ff53f0499c2
How to install:
1. If you don't have it, get Discord from https://discordapp.com/apps
2. Download BetterDiscord for your platform on https://betterdiscord.net/home
3. Push the button «Raw» then Ctrl + S.
3. Place the plugin in %appdata%\BetterDiscord\plugins\.
4. Refresh Discord with Ctrl + Shift + R or just restart Discord completely.
5. Go to the BetterDiscord settings → plugins tab and check plugin.
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
chown -R baka-user:www-data wp-content/uploads/
chmod -R 0775 wp-content/uploads/
chown baka-user:www-data wp-config.php
chmod 0640 wp-config.php
<?php
function getTmp() {
// returns file handle, similar to the one returned by fopen, for the new file or false on failure.
$handle = tmpfile();
$path = stream_get_meta_data($handle)['uri'];
var_dump(fwrite($handle, 'foo')); // 3
var_dump(fread($handle, 42)); // ""
var_dump(fgets($handle)); // false
var_dump(file_get_contents($path)); // "foo"
var_dump(file_exists($path)); // true
@shtrih
shtrih / Csv.php
Last active February 19, 2020 20:59
<?php
/**
* Created by PhpStorm.
* User: shtrih
* Date: 24.09.2017
* Time: 21:57
*/
namespace App\Util;
@shtrih
shtrih / donotasktoask_ru.md
Created February 14, 2018 02:02 — forked from ValdikSS/donotasktoask_ru.md
Спрашивайте сразу

Вам отправили это сообщение по следующим возможным причинам:

  • Вы поприветствовались и ждете ответа
  • Вы спросили о том, можно ли задать вопрос, и ждете ответа
  • Вы скинули запрос авторизации и ждете ответа

Пожалуйста, не делайте так. Задавайте вопрос сразу, без прелюдий, без запросов авторизации (в том числе и в Jabber), и ждите ответа. Не повторяйте свой вопрос и не спрашивайте, на месте ли я.

Здесь комментарии не пишите, уведомление о них не приходит ни мне, ни вам.

Если вам интересно получить развернутый ответ и аргументы, почему не стоить здороваться и ожидать ответа при общении онлайн:

@shtrih
shtrih / loop.sh
Created August 1, 2018 16:44
Bash loop command over arguments
#!/bin/sh
# usage: ./loop.sh "command name" arg1 arg2 2>&1 | tee loop.log
for i; do
if [ "$1" = "$i" ]; then
continue;
fi
echo "\n\n" $1 "$i";
VAR=$($1 "$i");
@shtrih
shtrih / tweetdeck-image-to-discord.user.js
Last active November 23, 2019 15:39
Post image from twitter (and tweetdeck!) to Discord (or Slack) channel in one click! Tested in Tampermonkey for Chrome. Fill out variables discordHookUri/slackHookUri to work! Moved to: https://github.com/shtrih/twitter-repost-image-to-discord
// ==UserScript==
// @name tweetdeck-image-to-discord.user.js
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Repost Image to Discord (or to Slack) via Webhook in one click!
// @author shtrih
// @match https://tweetdeck.twitter.com/*
// @require https://code.jquery.com/jquery-3.3.1.min.js#sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=
// @grant GM_xmlhttpRequest
// @connect discordapp.com