Skip to content

Instantly share code, notes, and snippets.

View EncodeTheCode's full-sized avatar
💭
Coding useful tools for workflow.

EncodeTheCode

💭
Coding useful tools for workflow.
View GitHub Profile
import ctypes
def get_windows_edition():
"""Return 'Home', 'Pro' or 'Server'."""
class OSV(ctypes.Structure):
_fields_ = [
("size", ctypes.c_ulong),
("major", ctypes.c_ulong),
("minor", ctypes.c_ulong),
("build", ctypes.c_ulong),
// concise_safe_get_windows_edition.cpp
// Build (MSVC): cl /O2 /W4 concise_safe_get_windows_edition.cpp
#include <windows.h>
#include <cstdio>
static void print_last_error(const char *ctx) {
DWORD err = GetLastError();
LPSTR msg = nullptr;
FormatMessageA(
(function(){
if(document.getElementById('rs')) return;
const s=document.createElement('div'), t=document.createElement('div');
s.id='rs'; Object.assign(s.style,{position:'fixed',top:0,right:0,width:'12px',height:'100%',background:'rgba(255,192,203,.2)',zIndex:2147483647,cursor:'pointer'});
Object.assign(t.style,{width:'100%',height:'60px',background:'deeppink',borderRadius:'6px',position:'absolute',top:0,transition:'box-shadow .18s,transform .18s'});
s.appendChild(t); document.body.appendChild(s);
let drag=false,startY=0,startScroll=0,focusTO;
const update=()=>{ const sh=document.body.scrollHeight-window.innerHeight, bh=s.clientHeight-t.offsetHeight; t.style.top=(sh? (window.scrollY/sh)*bh : 0)+'px'; };
t.onmousedown=e=>{ drag=true; startY=e.clientY; startScroll=window.scrollY; document.body.style.userSelect='none'; };
document.onmouseup=()=>{ drag=false; document.body.style.userSelect=''; };
(function addRS(){
if(document.getElementById('rs')) return;
const s=document.createElement('div'), t=document.createElement('div');
s.id='rs'; Object.assign(s.style,{position:'fixed',top:0,right:0,width:'12px',height:'100%',background:'rgba(255,192,203,0.2)',zIndex:999999,cursor:'pointer'});
t.id='rst'; Object.assign(t.style,{width:'100%',height:'60px',background:'deeppink',borderRadius:'6px',position:'absolute',top:0});
s.appendChild(t); document.body.appendChild(s);
let dragging=false, startY=0, startScroll=0;
const update=()=>{
const sh=document.body.scrollHeight-window.innerHeight, bh=s.offsetHeight-t.offsetHeight;
t.style.top = (sh && bh ? (window.scrollY/sh)*bh : 0) + 'px';
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Rogue — Talent Build Mock (HTML5 + JS) [Unlocked]</title>
<style>
:root{--bg:#0f1724;--panel:#0b1220;--accent:#0ea5e9;--muted:#94a3b8;--node:#111827}
html,body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:linear-gradient(180deg,#071226 0%, #021017 100%);color:#e6eef6}
#game-wrap{display:flex;height:100vh;gap:12px;padding:12px;box-sizing:border-box}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Rogue — Talent Build Mock (HTML5 + JS) [Unlocked]</title>
<style>
:root{--bg:#0f1724;--panel:#0b1220;--accent:#0ea5e9;--muted:#94a3b8;--node:#111827}
html,body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:linear-gradient(180deg,#071226 0%, #021017 100%);color:#e6eef6}
#game-wrap{display:flex;height:100vh;gap:12px;padding:12px;box-sizing:border-box}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WoW-Style Rogue Talent Mock</title>
<style>
body { margin:0; background:#081018; color:#e6eef6; font-family:Arial }
canvas { background:#0b1324; display:block; margin:10px auto; border-radius:8px }
.overlay { position:fixed; inset:0; background:rgba(0,0,0,.6); display:none; align-items:center; justify-content:center }
.window { background:#0e1628; padding:16px; width:1000px; border-radius:12px; display:flex; gap:12px }
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Rogue — Talent Build Mock (HTML5 + JS)</title>
<style>
:root{--bg:#0f1724;--panel:#0b1220;--accent:#0ea5e9;--muted:#94a3b8;--node:#111827}
html,body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:linear-gradient(180deg,#071226 0%, #021017 100%);color:#e6eef6}
#game-wrap{display:flex;height:100vh;gap:12px;padding:12px;box-sizing:border-box}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Rogue — Talent Build Mock (HTML5 + JS)</title>
<style>
:root{--bg:#0f1724;--panel:#0b1220;--accent:#0ea5e9;--muted:#94a3b8;--node:#111827}
html,body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:linear-gradient(180deg,#071226 0%, #021017 100%);color:#e6eef6}
#game-wrap{display:flex;height:100vh;gap:12px;padding:12px;box-sizing:border-box}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Rogue — Talent Build Mock (HTML5 + JS)</title>
<style>
:root{--bg:#0f1724;--panel:#0b1220;--accent:#0ea5e9;--muted:#94a3b8;--node:#111827}
html,body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:linear-gradient(180deg,#071226 0%, #021017 100%);color:#e6eef6}
#game-wrap{display:flex;height:100vh;gap:12px;padding:12px;box-sizing:border-box}