Skip to content

Instantly share code, notes, and snippets.

View soda92's full-sized avatar

Maple soda92

View GitHub Profile
@learosema
learosema / markdown.js
Last active September 21, 2024 13:37
Markdown in ~100 lines of JS
const MAGIC = [
[/^###### (.+)$/g, '<h6>$1</h6>'],
[/^##### (.+)$/g, '<h5>$1</h5>'],
[/^#### (.+)$/g, '<h4>$1</h4>'],
[/^### (.+)$/g, '<h3>$1</h3>'],
[/^## (.+)$/g, '<h2>$1</h2>'],
[/^# (.+)$/g, '<h1>$1</h1>'],
[/ $/g, '<br/>'],
[/_(.+)_/g, '<u>$1</u>'],
[/\*(.+)\*/g, '<em>$1</em>'],
@mjul
mjul / GPG-FIX.md
Created November 18, 2022 19:02
gpg: signing failed: Inappropriate ioctl for device

Fixing GPG "Inappropriate ioctl for device" errors

6th November 2016 Linux 24 Comments https://d.sb/B5N 
    Error: gpg: using "D5673F3E" as default secret key for signing 
    Error: gpg: signing failed: Inappropriate ioctl for device 
    Error: gpg: [stdin]: sign+encrypt failed: Inappropriate ioctl for device
@BeErikk
BeErikk / VCProject.x64.9.0.config
Created November 25, 2021 11:40
Visual Studio 2008 modified paths
<?xml version="1.0" encoding="utf-8"?>
<VCPlatformConfigurationFile Version="8.00">
<Platform Name="VCProjectAMD64Platform.dll" Identifier="{656d8763-2429-11d7-8bf6-00b0d03daa06}">
<Directories
Include="$(CurrentVS)VC/Tools/MSVC/$(CurrentVCTools)/include;$(CurrentVS)VC/Tools/MSVC/$(CurrentVCTools)/atlmfc/include;$(CurrentVS)VC/Auxiliary/VS/include;$(CurrentVS)VC/Auxiliary/VS/UnitTest/include;$(CurrentKits)10/Include/$(CurrentUCRT)/ucrt;$(CurrentKits)10/Include/$(CurrentUCRT)/winrt;$(CurrentKits)10/Include/$(CurrentUCRT)/cppwinrt;$(CurrentKits)10/Include/$(CurrentUCRT)/um;$(CurrentKits)10/Include/$(CurrentUCRT)/shared;$(CurrentKits)10/Include/$(CurrentUCRT)/km;$(CodeLibraries)include;$(CodeLibraries)include/wtl;$(WindowsSource)include;"
Library="$(CurrentVS)VC/Tools/MSVC/$(CurrentVCTools)/lib/x64;$(CurrentVS)VC/Tools/MSVC/$(CurrentVCTools)/atlmfc/lib/x64;$(CurrentVS)VC/Auxiliary/VS/UnitTest/lib;$(CurrentKits)10/Lib/$(CurrentUCRT)/ucrt/x64;$(CurrentKits)10/Lib/$(CurrentUCRT)/um/x64;$(CurrentKits)10/Lib/
@vheidari
vheidari / msys2-set-prroxy.txt
Last active December 21, 2024 06:40
MSYS2 - How to set proxy settings in msys2
# Add below lines to the profile in : /etc/profile
# Proxy Setting
export HTTP_PROXY="IpAddress:Port" # Like: 127.0.0.1:1477
export HTTPS_PROXY=$HTTP_PROXY
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTP_PROXY
@primaryobjects
primaryobjects / hotspot-keep-alive.ps1
Last active April 2, 2025 02:24
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
@datio
datio / enable-wifi.ps1
Last active March 28, 2025 10:36
Enable Windows 10 & 11 WiFi Hotspot - Powershell Script
# https://stackoverflow.com/questions/45833873/enable-win10-inbuild-hotspot-by-cmd-batch-powershell/60444585#answer-60444585
[Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime] | Out-Null
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
@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@munificent
munificent / generate.c
Last active January 27, 2025 18:14
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@Pagliacii
Pagliacii / win_api_test.py
Last active January 9, 2025 10:49
Use ctypes to call WIndows API
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import ctypes
import os
from ctypes import windll, wintypes
from typing import Optional
NULL: int = 0
@topin89
topin89 / get_processes_dlls_threads.py
Created June 12, 2018 20:52
For Windows, get all processes, theirs modules (aka DLLs) and threads in Python 3
#Based on recipe http://code.activestate.com/recipes/576362-list-system-process-and-process-information-on-win/
#also hosted here https://github.com/ActiveState/code/blob/master/recipes/Python/576362_List_System_Process_Process/recipe-576362.py
#by winterTTr Dong , http://code.activestate.com/recipes/users/4164498/
#updated by topin89
#License: MIT
from ctypes import c_long , c_int , c_uint , c_char , c_ubyte , c_char_p , c_void_p, c_size_t, c_ulong, c_wchar
from ctypes import windll
from ctypes import Structure
from ctypes import sizeof , POINTER , pointer , cast