Skip to content

Instantly share code, notes, and snippets.

View am11's full-sized avatar
🎉
if you are reading this, have a great day!

Adeel Mujahid am11

🎉
if you are reading this, have a great day!
View GitHub Profile
@am11
am11 / CHM3PerfectHashGenerator.cs
Last active May 4, 2024 10:06
CHM3 Hash Table Generator
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
// input format is hex with 0x prefix; one per line:
// 0x5DF
// 0x123
// etc.
CHM3PerfectHashGenerator hasher = new(File.ReadAllLines(args[0])
@am11
am11 / DotnetWithDeno.csproj
Last active June 4, 2023 23:24
.NET <-> Deno Interop
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>myApp.js</WasmMainJSPath>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</Project>
@am11
am11 / JSON in pure Bash
Created December 26, 2020 07:52 — forked from mzpqnxow/json.sh
bash JSON implementation
# functions for parsing and generating json
_json_get_var() {
# dest=$1
# var=$2
eval "$1=\"\$${JSON_PREFIX}$2\""
}
_json_set_var() {
# var=$1
@am11
am11 / Program.cs
Last active August 1, 2020 15:58
Marshal.PtrToStringUni with non null-terminated string (linux x64)
using System;
using System.Runtime.InteropServices;
unsafe class Program
{
[DllImport("libnullterm")]
private static extern IntPtr getstrWithNullTerminator(byte* inArray);
[DllImport("libnullterm")]
private static extern IntPtr getstrWithoutNullTerminator(byte* inArray);
@am11
am11 / aports-workbench.sh
Last active July 10, 2021 13:44
Setup Alpine Linux aports builder workbench
#!/usr/bin/env sh
apk update
apk --no-cache add alpine-sdk coreutils cmake less nano openssh sudo
adduser -G abuild -g "Alpine Package Builder" -s /bin/ash -D builder
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
mkdir /packages
chown builder:abuild /packages
su builder
abuild-keygen -anq
@am11
am11 / Dockerfile
Last active December 2, 2019 14:47
CoreRT windows docker
FROM microsoft/windowsservercore
RUN powershell curl https://aka.ms/vs/15/release/vs_buildtools.exe -O vs_buildtools.exe
RUN powershell curl https://github.com/git-for-windows/git/releases/download/v2.24.0.windows.2/Git-2.24.0.2-64-bit.exe -O git-setup.exe
RUN powershell curl https://cmake.org/files/v3.16/cmake-3.16.0-win64-x64.msi -O cmake-setup.msi
RUN powershell Start-Process git-setup.exe -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES','/CLOSEAPPLICATIONS', '/DIR=C:\git' -Wait
RUN msiexec /i cmake-setup.msi /quiet /norestart && \
setx PATH "%ProgramFiles%\CMake\bin;%PATH%"
@am11
am11 / mass-editing-csproj-files-in-vs.md
Last active November 29, 2016 09:26
How to mass-edit *proj files in VS using PowerShell

How to mass-edit *proj files in VS

  • In powershell, we first rename all csproj files to csprojxxx; so VS does not try to open them as projects instead treat them as text files:

    ls -r *.csproj | rename-item -force -newname { [io.path]::ChangeExtension($_.name, "csprojxxx") }
  • In File Explorer, navigate to project directory and search for *.csprojxxx, then drag all the items onto a new VS instace.

@am11
am11 / overload_resolution.bug.cpp
Created October 31, 2015 22:13
Overload resolution bug repro in VS2015 RTM (gathered from Stephan T. Lavavej aka STL)
// Discussion: https://github.com/Snaipe/Criterion/issues/51
namespace Std {
template <class Elem> struct CharTraits { };
template <class Elem, class Traits = CharTraits<Elem>> struct BasicOstream {
void operator<<(const void *) = delete;
};
template <class Traits> void operator<<(BasicOstream<char, Traits>&, const char *) = delete;
@am11
am11 / SassMeister-input.scss
Last active August 29, 2015 14:18
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
h2 {
color:blind;
}
@media print{
h1 {
@am11
am11 / SassMeister-input.scss
Created March 14, 2015 15:01
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
.a {
b:c;
d:
}