Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
primaryobjects / hotspot-keep-alive.ps1
Last active May 16, 2024 08:55
Script to Enable Windows 10 Mobile Hotspot Automatically After Reboot
# https://superuser.com/a/1434648
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
@liusheng
liusheng / make-protoc-2.5.0-statically-linked.sh
Last active April 12, 2024 02:57
protobuf 2.5.0 ARM64 support
apt-get update && apt-get install -y make cmake gcc g++ patch
curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz | tar zx -C /opt/
cd /opt/protobuf-2.5.0
curl -L -O https://gist.githubusercontent.com/liusheng/64aee1b27de037f8b9ccf1873b82c413/raw/118c2fce733a9a62a03281753572a45b6efb8639/protobuf-2.5.0-arm64.patch
patch -p1 < protobuf-2.5.0-arm64.patch
./configure --disable-shared
make
ls -l src/protoc
@Sup3rc4l1fr4g1l1571c3xp14l1d0c10u5
Sup3rc4l1fr4g1l1571c3xp14l1d0c10u5 / TopologicalSort.cs
Created June 18, 2016 15:15
Topological Sorting (Kahn's algorithm) implemented in C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace TopologicalSort {
static class Program {
static void Main() {
//
// digraph G {
// "7" -> "11"