Skip to content

Instantly share code, notes, and snippets.

View minhhungit's full-sized avatar
😘
Hello world

Jin minhhungit

😘
Hello world
View GitHub Profile
@minhhungit
minhhungit / AESGCM.cs
Created July 19, 2024 19:09 — forked from jbtule/AESGCM.cs
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@minhhungit
minhhungit / haproxy_letsencrypt.md
Created July 15, 2024 17:47 — forked from lmmendes/haproxy_letsencrypt.md
# HAProxy and Let's Encrypt

HAProxy and Let's Encrypt

HAProxy is a open-source TCP/HTTP load-balancing proxy server supporting native SSL, keep-alive, compression CLI, and other modern features.

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. Let’s Encrypt is a service provided by the Internet Security Research Group (ISRG).

Concept

// Zero-Clause BSD (more permissive than MIT, doesn't require copyright notice)
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
@minhhungit
minhhungit / GoDaddySSLHAProxy.md
Created January 28, 2023 10:57 — forked from sethwebster/GoDaddySSLHAProxy.md
Creating a PEM for HaProxy from GoDaddy SSL Certificate

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

@minhhungit
minhhungit / CloudflareHttpHandler.cs
Created January 19, 2023 00:44 — forked from xHeaven/CloudflareHttpHandler.cs
Cloudflare http handler in C# allows scraping cloudflare protected websites
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using Microsoft.ClearScript.V8;
@minhhungit
minhhungit / RedisJobQueue.cs
Created December 8, 2022 14:44 — forked from tenowg/RedisJobQueue.cs
A Message/Job Queue based on StackExchange.Redis and Redis Server
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using StackExchange.Redis;
namespace CitySurvival.Redis
{
@minhhungit
minhhungit / BitSet.cs
Created September 1, 2021 05:25 — forked from NightOwl888/BitSet.cs
C# port of the java.util.BitSet class
/* BitSet.cs -- A vector of bits.
Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
@minhhungit
minhhungit / Find SHRINK sessions with lock info.sql
Created August 15, 2021 06:20 — forked from EitanBlumin/Find SHRINK sessions with lock info.sql
SQL queries to troubleshoot a long-running DBCC SHRINK operation
/*
Author: Eitan Blumin | https://www.eitanblumin.com
Create Date: 2020-03-18
Last Update: 2020-06-22
Description:
This script will detect currently running sessions in your database which are running DBCC SHRINK commands.
It will also output the name of any tables and indexes the session is currently locking.
Use this query to find out what causes a SHRINK to run for too long.
You may need to run it multiple times to "catch" the relevant info.