Skip to content

Instantly share code, notes, and snippets.

View LB--'s full-sized avatar

LB--

  • Clickteam
View GitHub Profile
#include <stdio.h>
#include <fcntl.h>
#if defined(__unix__) || defined (__CYGWIN__)
#include <unistd.h>
#else
#include <io.h>
#endif
#ifndef O_BINARY
@LB--
LB-- / CMakeLists.txt
Created March 30, 2016 15:12
CMake Boost Example
cmake_minimum_required(VERSION 3.4)
project(boost-example
VERSION 0.0.0
LANGUAGES
CXX
)
find_package(Boost 1.60 REQUIRED
COMPONENTS
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@tamaskenez
tamaskenez / make_config_modules_relocatable.cmake
Last active March 24, 2020 12:17
converts the absolute paths found in CMake config-modules to paths relative to the root of the install tree
# This script fixes the absolute paths, which reference a file within
# a tree (usually the install dir).
#
# It's only input parameter is the root directory (usually the dir set as
# CMAKE_INSTALL_PREFIX).
#
# First it globs all the *.cmake file within the directory.
# Scans them for the root dir.
# If found, introduces a new INSTALL_PREFIX_... variable in the script,
# derived from the location of that script and replaces all references to
@LB--
LB-- / CMakeLists.txt
Last active August 11, 2019 17:17
CMake Bootstrap
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
ExternalProject_Add(CMake
GIT_REPOSITORY "git://github.com/Kitware/CMake.git"
# GIT_TAG "next"
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_LIST_DIR}/install"
# "-DBUILD_SHARED_LIBS=OFF"
TEST_EXCLUDE_FROM_MAIN 1
@LB--
LB-- / ResonanceCascade.cpp
Created September 6, 2015 00:17
C++ supports multiple active exceptions at once - see it in action at http://melpon.org/wandbox/permlink/PscHg988AnzjajyS
#include <iostream>
#include <stdexcept>
#include <exception>
struct ResonanceCascade final
{
ResonanceCascade()
{
std::cout << "ResonanceCascade ctor" << std::endl;
}
@jbevain
jbevain / README.md
Last active November 16, 2023 12:11
pdb2mdb for Visual Studio 2015

The Visual Studio Tools for Unity are able to convert .NET debug symbol files (namely pdb files) to debug symbols files that are understood by Unity's scripting engine (namely .dll.mdb files) when importing both the .dll and the .pdb in the Assets folder.

If you prefer to handle the conversion yourself you need to call a tool named pdb2mdb on the .dll associated with the .pdb:

pdb2mdb MyLibrary.dll

Will produce a MyLibrary.dll.mdb usable on Unity if MyLibrary.pdb is present.

@DavidEGrayson
DavidEGrayson / ubsan_shell_session.txt
Last active May 30, 2016 03:26
Sadly -fsanitize=undefined does not work in MSYS2/mingw-w64. Cannot find -lubsan at link time.
$ cat test.c
int main() { return 0; }
$ gcc -v -fsanitize=undefined test.c
Using built-in specs.
COLLECT_GCC=D:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.2.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=
package net.adamqpzm.steadfast;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Steadfast extends JavaPlugin implements Listener {
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.