This file contains 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
<?php | |
function addpadding($string, $blocksize = 32) { | |
$len = strlen($string); | |
$pad = $blocksize - ($len % $blocksize); | |
$string .= str_repeat(chr($pad), $pad); | |
return $string; | |
} | |
$key = '12345678901234567890123456789012'; | |
$post_data_str = 'abcdefghijklmnop'; |
This file contains 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' | |
key = '12345678901234567890123456789012' | |
iv = '1234567890123456' | |
data = 'abcdefghijklmnop' | |
cipher = OpenSSL::Cipher::AES.new(256, :CBC) | |
cipher.encrypt | |
cipher.padding = 32 | |
cipher.key = key |
This file contains 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
class String | |
# Escape Unicode control characters except \t \r \n | |
def escape_unicode_control_characters | |
gsub(/(?<unicode_control_characters>[\p{C}&&[^\t\r\n]]+)/u) do |_match| | |
Regexp.last_match[:unicode_control_characters].unpack('U*').map { |i| '\u' + i.to_s(16).rjust(4, '0') }.join | |
end | |
end | |
end | |
require 'json' |
This file contains 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 "heroku-api" | |
# heroku = Heroku::API.new(:api_key => API_KEY) # use API Key | |
# heroku = Heroku::API.new(:username => USERNAME, :password => PASSWORD) # use username and password | |
# heroku = Heroku::API.new(:headers => {'User-Agent' => 'custom'}) # use custom header | |
# NOTE: You can leave out the :api_key if ENV['HEROKU_API_KEY'] is set instead. | |
# https://github.com/heroku/heroku.rb | |
namespace :heroku do |
This file contains 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
#!/usr/bin/env ruby | |
require "benchmark" | |
require "httparty" | |
require "parallel" | |
# You need to modify your open file limit | |
# if you trying to run this on Mac OS | |
Benchmark.bmbm do |x| | |
x.report("Ruby Thread.new") do |
This file contains 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
#!/usr/bin/env python3 | |
import threading | |
import urllib.request | |
def worker(index, results): | |
req = urllib.request.urlopen('https://www.facebook.com/') | |
results.append(req.getcode()) | |
results = [] |
This file contains 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
# lib/tasks/benchmark.rake | |
namespace :benchmark do | |
task run_sidekiq: :environment do | |
batch = Sidekiq::Batch.new | |
batch.on(:complete, TestWorker) | |
batch.jobs do | |
200.times do | |
TestWorker.perform_async | |
end |
This file contains 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
logfile=$(date +%Y%m%d%H%M).log | |
targetfile=test.zip | |
# Start 1 processes for cracking mixalpha-numeric maximum 5 digits | |
fcrackzip -c Aa1 -b -l 1-5 --verbose -u $targetfile & >> $logfile & | |
# Start 62 processes for cracking mixalpha-numeric equal to 6 digits | |
eval echo\ {A..Z}AAAAA\; | xargs -I % -P 26 fcrackzip -c Aa1 -b -p % --verbose -u $targetfile >> $logfile & | |
eval echo\ {a..z}AAAAA\; | xargs -I % -P 26 fcrackzip -c Aa1 -b -p % --verbose -u $targetfile >> $logfile & | |
eval echo\ {0..9}AAAAA\; | xargs -I % -P 10 fcrackzip -c Aa1 -b -p % --verbose -u $targetfile >> $logfile & |
This file contains 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
// Alert Contact Type: Web-Hooks | |
// URL to Notify: https://discordapp.com/api/webhooks/{WEB_HOOK_ID}/{TOKEN}? | |
// POST Value (JSON Format): | |
{ | |
"content": "Monitor is *alertTypeFriendlyName*: *monitorFriendlyName* ( *monitorURL* )\n```*alertDetails*```" | |
} |
This file contains 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
// Place your settings in this file to overwrite the default settings | |
// Extensions: | |
// - ESLint | |
// - Material Icon Theme | |
// - Material Theme Kit | |
// - Ruby | |
// - stylelint | |
{ | |
"editor.scrollBeyondLastLine": false, | |
"editor.tabSize": 2, |
OlderNewer