Skip to content

Instantly share code, notes, and snippets.

View vitaliel's full-sized avatar

Vitalie Lazu vitaliel

  • Moldova, Chisinau
View GitHub Profile
# Ported code from https://stackoverflow.com/questions/46888656/how-to-check-password-in-node-js-from-aspnetusers-net-core
# ruby 2.5.1
require "base64"
require "openssl"
# Value from table AspNetUsers, PasswordHash field
h="AQAAAAEAACcQAAAAEFzA9xEehSfcI4qgvuIPlkAXTzLrPuvVtVDW3g4+QHTR4XoIzXUikDJITOi82f4qWQ=="
h_bytes = Base64.decode64(h)
<%- headers = ['Identifier', 'Service', 'Start time', 'Called Number', 'Duration (seconds)', 'price'] -%>
<%= CSV.generate_line headers -%>
<%- cdrs_collection.find_each do |record| -%>
<%= CSV.generate_line([record.id, record.customer_service.name, record.start, URI.decode(record.called), record.billsec, number_to_currency(record.price)]) -%>
<%- end -%>
-- Show FKeys
SELECT
tc.table_schema,
tc.constraint_name,
tc.table_name,
kcu.column_name,
ccu.table_schema AS foreign_table_schema,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
@vitaliel
vitaliel / AngleCheck.cs
Created October 27, 2021 14:46
POC for replacing inline images with separate http requests
using System;
using System.Linq;
using AngleSharp.Html.Parser;
namespace ParsingCheck
{
public class AngleCheck
{
// POC for replacing inline images with separate http requests
// AngleSharp v0.16.1
@vitaliel
vitaliel / customer_index.rb
Last active December 18, 2023 20:06
SearchFlip: Opensearch, skip ssl verification
# Skip ssl verification for local opensearch service
class CustomerIndex
include SearchFlip::Index
# Tested on OpenSearch 1.3 and 2.5
def self.connection
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
http_client = SearchFlip::HTTPClient.new(plugins: [
@vitaliel
vitaliel / password-input.component.html
Created January 13, 2023 12:47
Angular password component
<div class="input-group">
<input [type]="fieldTextType ? 'text' : 'password'" class="form-control"
placeholder="Password"
[id]="formControlName"
[formControl]="control" />
<div class="input-group-append">
<span class="input-group-text">
<i
class="fa"
[ngClass]="{