Skip to content

Instantly share code, notes, and snippets.

@1999AZZAR
1999AZZAR / DoH Setup with cloudflared.md
Last active February 27, 2026 20:10
This guide explains how to set up DNS over HTTPS (DoH) on a Linux system using `cloudflared`. DoH ensures that your DNS queries are encrypted and secure, protecting your online privacy and preventing third-party monitoring of your internet activity.
@elliotwutingfeng
elliotwutingfeng / ubuntu-24.04-2014-macbook-air.md
Last active December 23, 2025 21:52
Installing Ubuntu 24.04 on a 2014 Macbook Air

Installing Ubuntu 24.04 on a 2014 Macbook Air

  • Recommended: Use LVM + Encryption.
  • Expect slow installation speeds (the ports are USB 3.0 but are stuck at 2.0 speeds during installation)
  • Do not bother with installing proprietary components during OS installation; it is too slow. Do it post-installation.

Wi-Fi

  • Wi-Fi will not work out of the box. You will need a USB Wi-Fi dongle to download Wi-Fi drivers from the Internet.
  • After installing the OS, plug in your Wi-Fi dongle and run the following commands to update the system, install Wi-Fi drivers, and upgrade snap packages.
// Non-generic collections
T:System.Collections.ArrayList;Use List<T>
T:System.Collections.Hashtable;Use Dictionary<TKey, TValue>
// Blocking Task operations
P:System.Threading.Tasks.Task.Result;Await it
M:System.Threading.Tasks.Task.Wait;Await it
M:System.Threading.Tasks.Task.GetAwaiter;Await it
M:System.Runtime.CompilerServices.TaskAwaiter.GetResult;Await it
M:System.Threading.Tasks.Task.WaitAll`1;Use await Task.WhenAll()
@davidfowl
davidfowl / .NET6Migration.md
Last active March 7, 2026 11:20
.NET 6 ASP.NET Core Migration
@Zoxive
Zoxive / gist:bcfc30e0518be6db8870efb12e16e8e4
Last active April 24, 2024 13:49
Favorite CSharp Analyzers
<PackageReference Include="SmartAnalyzers.CSharpExtensions.Annotations" Version="3.10.0" />
<PackageReference Include="AsyncSuffixAnalyzer" Version="1.0.6285.32977" PrivateAssets="All"/>
<PackageReference Include="Lindhart.Analyser.MissingAwaitWarning" Version="1.2.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.7" PrivateAssets="All"/>
<PackageReference Include="AsyncFixer" Version="1.1.6" PrivateAssets="All"/>
<PackageReference Include="Roslynator.Analyzers" Version="2.2.0" PrivateAssets="All"/>
<PackageReference Include="Roslynator.CodeFixes" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Nopen.NET" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Apex.Analyzers.Immutable" Version="1.2.5" PrivateAssets="All" />
<PackageReference Include="Apex.Analyzers.Immutable.Attributes" Version="1.0.0" />
@tom-erik
tom-erik / migrate.sql
Created February 15, 2018 12:01
DB Migration objects
If Not Exists (Select 1 From INFORMATION_SCHEMA.ROUTINES Where SPECIFIC_SCHEMA = 'dbo' And SPECIFIC_NAME = 'fnIndexExists' And ROUTINE_TYPE = 'FUNCTION')
Begin
Exec('
Create Function [dbo].[fnIndexExists](@table_name nvarchar(max), @index_name nvarchar(max))
Returns bit
Begin
Return (Select Cast(Count(*) as Bit) From sys.indexes Where object_id = Object_Id(@table_name) AND name = @index_name);
End')
End
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\W3SVC /v SvcHostSplitDisable /t REG_DWORD /d 1 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\WAS /v SvcHostSplitDisable /t REG_DWORD /d 1 /f
@NickCraver
NickCraver / ExampleUsage.cs
Last active October 16, 2024 02:37
Code to mark a SQL string before it's passed to Dapper.
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
@NickCraver
NickCraver / BotLovin.cs
Last active May 5, 2025 19:35
Some bot/crawler fun on Stack Overflow. 10 hours of fun, to be precise.
private static readonly string[] tenHoursOfFun =
{
"https://www.youtube.com/watch?v=wbby9coDRCk",
"https://www.youtube.com/watch?v=nb2evY0kmpQ",
"https://www.youtube.com/watch?v=eh7lp9umG2I",
"https://www.youtube.com/watch?v=z9Uz1icjwrM",
"https://www.youtube.com/watch?v=Sagg08DrO5U",
"https://www.youtube.com/watch?v=5XmjJvJTyx0",
"https://www.youtube.com/watch?v=IkdmOVejUlI",
"https://www.youtube.com/watch?v=jScuYd3_xdQ",
@alirobe
alirobe / reclaimWindows10.ps1
Last active March 18, 2026 18:42
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
### OR take a look at
### https://github.com/HotCakeX/Harden-Windows-Security