Skip to content

Instantly share code, notes, and snippets.

View uzbekdev1's full-sized avatar
🌴
On vacation

Elyor Latipov uzbekdev1

🌴
On vacation
View GitHub Profile
public class Solution {
public int CalPoints(string[] ops) {
var score = new List<int>();
for (int i = 0; i < ops.Length; i++)
{
string c = ops[i];
if (c == "+")
{
# Method: POST
# Headers
# Authorization Bearer eyJhbGciO... (access token)
# Content-Type: application/json
# Body
# {
# "username": "test-user",
# "groups": ["Comp1"], // doesn't work, even if it is in the docs
# "lastName": "test",
@uzbekdev1
uzbekdev1 / startup.cs
Last active November 19, 2021 12:39
keycloack auth .net core api
//ConfigureServices
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.MetadataAddress = "https://{host}/auth/realms/{realm}/.well-known/openid-configuration";
options.RequireHttpsMetadata = true;
options.IncludeErrorDetails = true;
options.SaveToken = true;
@uzbekdev1
uzbekdev1 / Decrypt.cs
Created November 3, 2021 16:20 — forked from ginxx009/Decrypt.cs
Encryption & Decryption MD5 C#
private void btnDecrypt_Click(object sender, EventArgs e)
{
byte[] data = Convert.FromBase64String(textBox4.Text); // decrypt the incrypted text
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
{
byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
using (TripleDESCryptoServiceProvider tripDes = new TripleDESCryptoServiceProvider() { Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
{
ICryptoTransform transform = tripDes.CreateDecryptor();
byte[] results = transform.TransformFinalBlock(data, 0, data.Length);
@uzbekdev1
uzbekdev1 / clean_code.md
Created October 28, 2021 21:08 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@uzbekdev1
uzbekdev1 / clean_code.md
Created October 28, 2021 21:08 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@uzbekdev1
uzbekdev1 / .htaccess
Last active October 23, 2021 20:19
Font awesome issue in the htaccess file (only FX browser)
# -------------------------
# HTACCESS FILE
# -------------------------
AddDefaultCharset utf-8
Options +FollowSymLinks
# RESTRICTIONS
# Disallow direct access to this file and any log / cache file
# Prevent directory browsing
@uzbekdev1
uzbekdev1 / run.sh
Last active October 22, 2021 14:36
RabbitMQ Cluster
# Dokcer info
docker info
# create custom bridge network
docker network create mynet
docker network inspect mynet
# rabbit1 is hostname , erlang cookie is defined to facilitate cluster
#Node 1
@uzbekdev1
uzbekdev1 / startup.bat
Created October 17, 2021 20:27
HyberV autostart change
bcdedit /set hypervisorlaunchtype auto
@uzbekdev1
uzbekdev1 / locale.cs
Created October 17, 2021 20:26
.net core json tim zone
services.AddControllers(). (options =>
{
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local;
});