This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl/cipher' | |
module Cipher | |
Algorithm = 'aes-256-cbc' | |
def encrypt(text, key) | |
cipher = OpenSSL::Cipher::Cipher.new(Cipher::Algorithm) | |
cipher.encrypt | |
cipher.pkcs5_keyivgen(key) | |
secret = cipher.update(text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INSERT SORT ALGORITHM | |
# _____________________________________________________ | |
# $ ruby insert_sort.rb.rb 1 8 7 2 3 0 -1 8 3 7 6 -1 | |
# insert sort argorithm | |
# original data: [1, 8, 7, 2, 3, 0, -1, 8, 3, 7, 6, -1] | |
# sorted data: [-1, -1, 0, 1, 2, 3, 3, 6, 7, 7, 8, 8] | |
arr = ARGV.map(&:to_i) | |
puts <<DESC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [82, 20, -1, 92, 0, 28, 8, 10] | |
for i in -1..array.length | |
min = i | |
for j in i+1..array.length.pred | |
if array[j] < array[min] | |
min = j | |
end | |
end | |
if min != i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(5..10).reduce(-3, :+) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 = :continue | |
101 = :switching_protocols | |
102 = :processing | |
200 = :ok | |
201 = :created | |
202 = :accepted | |
203 = :non_authoritative_information | |
204 = :no_content | |
205 = :reset_content | |
206 = :partial_content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Edit mc’s ini file (either ~/.mc/ini or ~/.config/mc/ini) and look for the line [Colors]. Then, change the line base_color to this: | |
[Colors] | |
base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-compose up -d | |
docker attach myapp_web_1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
":"; exec emacs --no-site-file --script "$0" -- "$@" # -*-emacs-lisp-*- | |
(print (+ 2 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = Array.from("Hello world!"); | |
arrLen = arr.length; | |
arrMidLen = Math.floor(arrLen / 2); | |
arr.forEach(function(v, i) { | |
if (arrMidLen > i) { return } | |
var f = arr[i]; | |
var e = arr[arrLen - i - 1]; | |
arr[i] = e; | |
arr[arrLen - i - 1] = f; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $1 ]]; then | |
echo 'Set ./target/debug/<programm_name> as argument' | |
else | |
sudo rr record -n $1 | |
sudo rr replay -d rust-gdb ~/.local/share/rr/latest-trace | |
fi |
OlderNewer