Skip to content

Instantly share code, notes, and snippets.

View Alexhuszagh's full-sized avatar

Alexander Huszagh Alexhuszagh

View GitHub Profile
@Veedrac
Veedrac / print_buf64.cpp
Last active August 2, 2019 09:29
Prints integers really fast. Pads output with null bytes to length-20 for speed reasons. The code is released under CC0. The length calculation (neg_log2 * 1233 >> 12) is from Bit Twiddling Hacks, and also public domain.
const char DIGIT_PAIRS[] =
"00" "01" "02" "03" "04" "05" "06" "07" "08" "09"
"10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
"20" "21" "22" "23" "24" "25" "26" "27" "28" "29"
"30" "31" "32" "33" "34" "35" "36" "37" "38" "39"
"40" "41" "42" "43" "44" "45" "46" "47" "48" "49"
"50" "51" "52" "53" "54" "55" "56" "57" "58" "59"
"60" "61" "62" "63" "64" "65" "66" "67" "68" "69"
"70" "71" "72" "73" "74" "75" "76" "77" "78" "79"
"80" "81" "82" "83" "84" "85" "86" "87" "88" "89"
@guillochon
guillochon / ssh-airplane-wifi.md
Last active March 8, 2024 23:56
Instructions on how to SSH on airplane WiFi that blocks port 22

Using SSH through airplane WiFi that blocks port 22

Many aircraft that offer wifi only permit access to machines on port 80/443, the standard http(s) ports. If you want to SSH, you have to set up an intermediate machine that hosts the SSH service on either port 80 or 443. An easy (and free) way to do this is via a Google free-tier micro instance. These instances have a 1 GB transfer ceiling per month, but so long are you are only transmitting textual data a few days per month, this limit should not be easily exceeded. Set up one of these VMs via the Google Cloud console, and select CentOS 7 as the disk image. Make sure that you allow http/https traffic on the instance, the two checkboxes in the Firewalls section of the VM settings. Optionally, set a static external IP address for your server in the VM config, in case you don't want to look up the IP each time. Then, ssh into the new VM (the IP address will be listed as the "external IP" in the list of instances) and edi

@apaprocki
apaprocki / gist:2dc1041c8e88a293890750dca4181c91
Created March 23, 2017 19:33
_LIBCPP preprocessor defines
#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_ALGORITHM
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#define _LIBCPP_ASSERT(x,m) ((void)0)
#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR __attribute__((availability(macosx,strict,introduced=10.9))) __attribute__((availability
(ios,strict,introduced=7.0)))
#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
@lukas-h
lukas-h / license-badges.md
Last active September 17, 2024 21:32
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@gerardroche
gerardroche / sublime-clean
Last active June 3, 2024 19:16
Clean Sublime Text caches and optionally clean out any sessions
#!/bin/sh
set -e
unset CDPATH
unset IFS
show_usage() {
cat <<USAGE
Usage: [PROJECTS_PATH=<PATH>] $(basename "$0") [--exclude-sessions] [--exclude-workspaces]