Skip to content

Instantly share code, notes, and snippets.

View lonelyelk's full-sized avatar
💭

Sergey Kruk lonelyelk

💭
View GitHub Profile
@lonelyelk
lonelyelk / build
Last active February 17, 2023 01:30
Telegram Webhook Provider for Terraform
#!/bin/zsh
go build -o terraform-provider-telegram && cp terraform-provider-telegram ~/.terraform.d/plugins/lonelyelk.ru/aws/telegram/1.0.0/darwin_amd64
s = "stttartuuuup"
def compress(str)
complex_object = str.chars.each_with_object({result: ""}) do |char, obj|
if obj[:current] == char
obj[:count] += 1
next
elsif obj[:current]
obj[:result] += "#{obj[:count]}x#{obj[:current]}"
end
@lonelyelk
lonelyelk / generate key pair.sh
Created June 15, 2018 09:47
Asymmetric JWT token with Go
ssh-keygen -t rsa -b 2048 -f jwtRS256.key
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
@lonelyelk
lonelyelk / fastping.sh
Last active March 30, 2016 23:00
Fast and furious ping routine to detect if Internet is accessible or a computer is online.
#!/bin/bash
cnt=${2:-3}
to=${3:-1}
rcvd=$(set -o pipefail; timeout $to ping -A -s16 -c$cnt -q $1 2> /dev/null | grep received | awk -F', ' '{print $2}' | awk '{print $1}')
if [[ $? != 0 || $cnt != $rcvd ]]; then
exit 1
fi
@lonelyelk
lonelyelk / elk_reporter.js
Last active March 2, 2016 22:41
ElkReporter for jasmine when running tests in terminal (e.g. node). Made from jasmine standard ConsoleReporter.
/**
* This is modified version of Jasmine.js ConsoleReporter
*/
module.exports = exports = ElkReporter;
function Timer(options) {
options = options || {};
var now = options.now || (function (Date) { return function () { return new Date().getTime(); }; })(Date),
startTime;
s = "abc"
s.class == String # => true
s.class === String # => false
String === s.class # => false
s === String # => false
String === s # => true
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQINBFRU19UBEAD8+079s2G8XT5Gn2kRL1IZ9pqAJyeirBiz2CvragL/XmuAGhS0
7QIpPO8DNiXkDSjNYImPM56/qz/lyhTgirCRtWopEuH62LIqa2DDp1+B3WDp00OO
vbPSDvSJo/uVRxOF28QC4LmSXLUJeCa4B+RnQHvRfkNhKB9ridnBRVmlmxN3Hvki
OF0Vb6qRI+0ga6owX3+xxHiBLU6+RRWyy7cbx5p3meVii+xaAuc+1OLCQr4urPBg
nMEAkWeQFA4LAdDkX1qH0O19n621wXPTwfy9L0Q4vaPHA1GC/fw/QlGEAxaXtDu3
dwpRJ7N7btPth8fa6fSv9AKXJeQDV4xYLPWyX7Orz7Zfu55vKQ7uY00czqe4UnLu
fnL+RA0uZbgLdDrTDUxOXLnvuiANhY4PCCGXR5XWMRSoFcyWZQPQTQcFCojZixp2
@lonelyelk
lonelyelk / fbBefriended.user.js
Last active August 29, 2015 14:08
UserScript для удаления записей о том, кто с кем стал друзьями из фильтров (списков).
// ==UserScript==
// @name fbBefriended
// @description Remove friending notifocations from list feed
// @author Sergey Kruk
// @license MIT
// @version 0.0.4
// @match https://www.facebook.com/lists/*
// ==/UserScript==
(function (window, undefined) {
var main = window.document.getElementById("stream_pagelet");