Skip to content

Instantly share code, notes, and snippets.

View senid231's full-sized avatar
🇺🇦
Все буде Україна

Denis Talakevich senid231

🇺🇦
Все буде Україна
View GitHub Profile
@senid231
senid231 / crawler.rb
Last active January 17, 2023 21:56
parsing ukraine dtek oem shutdowns page and saving screenshot
#! /usr/bin/env ruby
# frozen_string_literal: true
# rubocop:disable Performance/Casecmp
require 'bundler/inline'
$stdout.sync = true
gemfile(true) do
source 'https://rubygems.org'
@senid231
senid231 / ssl_puma.sh
Created September 27, 2022 10:14 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@senid231
senid231 / nari_ultimate_testing.py
Created September 5, 2022 12:13 — forked from pieromarini/nari_ultimate_testing.py
Razer Nari Ultimate Testing
import usb.core
import usb.util
import usb.control
import time
import decimal
INTERFACE_NUMBER = 5
TIMEOUT = 2000
begin
require 'bundler/inline'
rescue LoadError => e
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
@senid231
senid231 / test_active_admin_capybara_bug_report.rb
Created April 1, 2022 12:16
Bug report template for active admin and capybara with CSS and JS
# frozen_string_literal: true
# see https://github.com/activeadmin/activeadmin/blob/master/tasks/bug_report_template.rb
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
# Use local changes or ActiveAdmin master.
if ENV['ACTIVE_ADMIN_PATH']
@senid231
senid231 / links.textile
Created December 5, 2021 10:07 — forked from lucashungaro/links.textile
Links de referência utilizados em minha palestra
@senid231
senid231 / postgres_queries_and_commands.sql
Last active November 23, 2021 15:48 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '' AND query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@senid231
senid231 / test_rails_system.rb
Last active March 4, 2021 15:19
rails bug report with system test with miniproxy
# frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.0.0'
@senid231
senid231 / aes-gcm.js
Created September 25, 2020 11:20 — forked from themikefuller/aes-gcm.js
AES-GCM Encryption and Decryption Examples using Web Crypto (subtle.crypto) JavaScript API
async function generateKey() {
return await crypto.subtle.generateKey({
"name":"AES-GCM",
"length":256
},true,['encrypt','decrypt']);
}
async function exportKey(key) {
return await crypto.subtle.exportKey('jwk', key);
}
@senid231
senid231 / ID.js
Created December 16, 2018 10:06
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`