Skip to content

Instantly share code, notes, and snippets.

@RistBS
RistBS / shellcode_exec_workerfactory.c
Last active May 2, 2024 13:47
Just another shellcode execution technique :)
#include <Windows.h>
#include <stdio.h>
#define PRINTDEBUG(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
#define WORKER_FACTORY_FULL_ACCESS 0xf00ff
typedef struct _UNICODE_STRING {
@pixelsnafu
pixelsnafu / CloudsResources.md
Last active May 2, 2024 13:46
Useful Resources for Rendering Volumetric Clouds

Volumetric Clouds Resources List

  1. A. Schneider, "Real-Time Volumetric Cloudscapes," in GPU Pro 7: Advanced Rendering Techniques, 2016, pp. 97-127. (Follow up presentations here, and here.)

  2. S. Hillaire, "Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite" in Physically Based Shading in Theory and Practice course, SIGGRAPH 2016. [video] [course notes] [scatter integral shadertoy]

  3. [R. Högfeldt, "Convincing Cloud Rendering – An Implementation of Real-Time Dynamic Volumetric Clouds in Frostbite"](https://odr.chalmers.se/hand

@zhmu
zhmu / magic_enum_reduced.h
Created February 12, 2023 11:07
Simpler magic_enum which only implements enum_to_string()
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 Rink Springer <rink@rink.nu>
//
// Based on https://github.com/Neargye/magic_enum/blob/master/include/magic_enum.hpp
// Copyright (c) 2019 - 2022 Daniil Goncharov <neargye@gmail.com>.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@karolzlot
karolzlot / tqdm_cpu_ram.py
Last active May 2, 2024 13:45
Monitoring real time cpu and ram usage with tqdm. If you like it please upvote this answer: https://stackoverflow.com/a/69511430/8896457
from tqdm import tqdm
from time import sleep
import psutil
with tqdm(total=100, desc='cpu%', position=1) as cpubar, tqdm(total=100, desc='ram%', position=0) as rambar:
while True:
rambar.n=psutil.virtual_memory().percent
cpubar.n=psutil.cpu_percent()
rambar.refresh()
cpubar.refresh()
@dozsolti
dozsolti / flatListCurrentIndex.js
Created December 18, 2021 22:38
How to get current index in FlatList - React Native
<FlatList
data={images}
horizontal
pagingEnabled
keyExtractor={...}
renderItem={...}
onMomentumScrollEnd={(event) => {
const index = Math.floor(
event.nativeEvent.contentOffset.x /
event.nativeEvent.layoutMeasurement.width
@dyejon
dyejon / debootstrap-focal-plasma.md
Created April 12, 2021 18:37
Debootstrap Ubuntu 20.04 with Plasma, without LiveUSB or netboot image

Ubuntu 20.04 LTS with minimal KDE

Netboot images are deprecated (not available at all for 20.10+) so debootstrap utility is used instead. I will install minimal Plasma desktop and enable OEM mode. Then I can create my user account from within OEM session.

Security notice

It seems like Chromium DEB is no longer updated, which is a huge security risk (v87 in repos, v89 upstream). "Sources list from 18.04" section is now removed, it is recommended to use Flatpak instead.

@bmatthewshea
bmatthewshea / certbot_pip_install-debian_ubuntu.md
Last active May 2, 2024 13:43
Debian/Ubuntu - CERTBOT without SNAP/SNAPD

CERTBOT - Install using Python PIP

Install Certbot using Python PIP (Package Installer for Python) - without using SNAP, APT or SYSTEMD. (Debian/Ubuntu)


This guide will help you install LetsEncrypt / Certbot using venv PIP under Debian/Ubuntu.

  • This guide has been tested up to Debian 12 / Bookworm.
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2024 13:42
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@DanielSWolf
DanielSWolf / Program.cs
Last active May 2, 2024 13:41
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@alexpchin
alexpchin / restful_routes.md
Last active May 2, 2024 13:40
7 Restful Routes
URL HTTP Verb Action
/photos/ GET index
/photos/new GET new
/photos POST create
/photos/:id GET show
/photos/:id/edit GET edit
/photos/:id PATCH/PUT update
/photos/:id DELETE destroy