Skip to content

Instantly share code, notes, and snippets.

View Ranger-X's full-sized avatar

Makeev Ivan Ranger-X

  • Russian Federation, Togliatty
View GitHub Profile
@Ranger-X
Ranger-X / tplink-archer-t4u.md
Created August 9, 2021 06:43 — forked from primaryobjects/tplink-archer-t4u.md
Steps to Install the TP-Link Archer T4U Plus AC1300 USB WiFi Adapter on Linux Mint
@Ranger-X
Ranger-X / ruby-gost-2.5.patch
Created December 12, 2019 20:41
Patch to add GOST encryption algorithms into Ruby
--- ruby-2.5.5/ext/openssl/lib/openssl/ssl.rb
+++ ruby-2.5.5-gost/ext/openssl/lib/openssl/ssl.rb
@@ -51,6 +51,8 @@ class SSLContext
OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10100000)
DEFAULT_PARAMS.merge!(
ciphers: %w{
+ GOST2001-GOST89-GOST89
+ GOST94-GOST89-GOST89
ECDHE-ECDSA-AES128-GCM-SHA256
ECDHE-RSA-AES128-GCM-SHA256
@Ranger-X
Ranger-X / kafka-move-leadership.sh
Created July 5, 2016 04:54 — forked from miguno/kafka-move-leadership.sh
A simple Ops helper script for Apache Kafka to generate a partition reassignment JSON snippet for moving partition leadership away from a given Kafka broker. Use cases include 1) safely restarting a broker while minimizing risk of data loss, 2) replacing a broker, 3) preparing a broker for maintenance.
#!/usr/bin/env bash
#
# File: kafka-move-leadership.sh
#
# Description
# ===========
#
# Generates a Kafka partition reassignment JSON snippet to STDOUT to move the leadership
# of any replicas away from the provided "source" broker to different, randomly selected
# "target" brokers. Run this script with `-h` to show detailed usage instructions.
$ip = "10.20.30.40"
$result = gwmi -query "SELECT * FROM Win32_PingStatus WHERE Address = '$ip'"
if ($result.StatusCode -eq 0) {
Write-Host "$ip is up."
}
else{
Write-Host "$ip is down."
Write-Host "Disconnecting..."
rasdial.exe DegreeVPN /DISCONNECT
Write-Host "Connecting..."
@Ranger-X
Ranger-X / new_gist_file.xml
Created December 9, 2013 07:39
advanced_logging
<advancedLogging>
<server>
<logDefinitions>
<logDefinition rollLogFileOnConfigChanges="false" writeLogDataToDisk="true" baseFileName="APILog" logRaiseTraceEvents="false" enabled="true" logRollOption="Schedule" maxDurationSeconds="86400" maxFileSizeKB="1024" schedule="Hourly" publishLogEvent="true">
<selectedFields>
<logField id="Date-Local" logHeaderName="date-local" required="false" defaultValue="" />
<logField id="Time-Local" logHeaderName="time-local" required="false" defaultValue="" />
<logField id="URI-Stem" logHeaderName="cs-uri-stem" required="false" defaultValue="" />
<logField id="URI-Querystring" logHeaderName="cs-uri-query" required="false" defaultValue="" />
<logField id="Referer" logHeaderName="cs(Referer)" required="false" defaultValue="" />
@Ranger-X
Ranger-X / new_gist_file
Created September 12, 2013 13:26
Копирование файлов через ssh с возобновлением
rsync --partial --progress --rsh=ssh user@host:remote_file local_file
@Ranger-X
Ranger-X / product_filters.rb
Created April 27, 2012 17:34
OptionValue filter
def ProductFilters.option_with_values(option_scope, option, values)
# get values IDs for Option with name {@option} and value-names in {@values} for use in SQL below
option_values = Spree::OptionValue.where(:presentation => [values].flatten).joins(:option_type).where(OptionType.table_name => {:name => option}).pluck("#{OptionValue.table_name}.id")
return option_scope if option_values.empty?
option_scope = option_scope.where("#{Product.table_name}.id in (select product_id from #{Variant.table_name} v left join spree_option_values_variants ov on ov.variant_id = v.id where ov.option_value_id in (?))", option_values)
option_scope
end
# option scope