Skip to content

Instantly share code, notes, and snippets.

@socantre
socantre / deploy-iOS-app.md
Last active February 28, 2021 23:58
Over the air iOS app deployment notes

Steps to prepare over the air app deployment without paid apple developer account using Xcode 7:

@socantre
socantre / solarized.txt
Created August 24, 2015 12:04
solarized color scheme
SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB
--------- ------- ---- ------- ----------- ---------- ----------- -----------
base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21
base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26
base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46
base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51
base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59
base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63
base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93
base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99
@socantre
socantre / CMakeLists.txt
Last active November 7, 2022 19:44
CMake; download file with specific hash. Probably better to use ExternalProject module to do this instead of doing it manually
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/download.cmake
"set(downloaded_file \"${CMAKE_CURRENT_BINARY_DIR}/pg44800.txt\")\n"
"set(url \"https://www.gutenberg.org/cache/epub/44800/pg44800.txt\")\n"
"set(expected_hash \"5a837b40a0f90211ff2883651f33a865\")\n"
"if (EXISTS \${downloaded_file})\n"
" file(MD5 \${downloaded_file} filehash)\n"
" message(\"\${downloaded_file} exists with hash: \" \${filehash})\n"
" if (\${expected_hash} STREQUAL \${filehash})\n"
" message(\"Hash matches expected hash.\")\n"
@socantre
socantre / CMakeLists.txt
Created August 24, 2015 03:45
Example of using add_custom_command and add_custom_target together in CMake to handle custom build steps with minimal rebuilding: This example untars library headers for an INTERFACE library target
set(LIBFOO_TAR_HEADERS
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo_utils.h"
)
add_custom_command(OUTPUT ${LIBFOO_TAR_HEADERS}
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
COMMAND ${CMAKE_COMMAND} -E touch ${LIBFOO_TAR_HEADERS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/foo"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
@socantre
socantre / CMakeLists.txt
Created August 24, 2015 03:27
automatically grab simple external dependencies using CMake. update step might hurt incremental build time. probably can be disabled.
...
include(ExternalProject)
...
ExternalProject_Add(catch
GIT_REPOSITORY "https://github.com/philsquared/Catch.git"
GIT_TAG "v1.2.1-develop.12"
CONFIGURE_COMMAND ""
@socantre
socantre / .minttyrc
Last active September 30, 2015 17:05
config for mintty (Git for Windows)
BoldAsFont=no
Font=Consolas
FontHeight=12
Black=7,54,66
Red=220,50,47
Green=133,153,0
Yellow=181,137,0
Blue=38,139,210
Magenta=211,54,130
Cyan=42,161,152
@socantre
socantre / .vimrc
Last active May 17, 2016 21:29
vimrc vim config file
" show command in bottom right corner
set showcmd
" show line numbers in gutter
set number
set relativenumber
" disable softwrap
set nowrap
set sidescroll=1
@socantre
socantre / brainf.cpp
Created August 6, 2015 20:17
simple brainf interpreter
#include <iostream>
#include <deque>
#include <string>
#include <cassert>
std::string create_print_program(std::string to_print) {
std::string program;
unsigned last_char = '\0';
for (char c : to_print) {
unsigned uc = (unsigned char)c;
@socantre
socantre / relative_date.cpp
Last active August 29, 2015 14:25
code to do relative date arithmetic. such as adding an arbitrary number of years, months and days to a particular date.
#include "date.h"
#include <chrono>
using namespace date;
struct relative_date {
years y {0};
months m {0};
days d {0};
explicit relative_date(years y) : y{y} {}
@socantre
socantre / main.cpp
Created July 8, 2015 22:32
stop Windows from displaying error dialogs
#include <exception>
#include <iostream>
#include <cstdlib> // _set_error_mode() and _set_abort_behavior()
#include <csignal> // signal()
#include <Windows.h> // SetErrorMode()
void abort_handler(int) { exit(30); }
int main() {