Skip to content

Instantly share code, notes, and snippets.

## Cmake Syntax highlighting
##
syntax "cmake" "CMakeLists.txt" "cmakelists.txt" "\.(cmake|cmake.in|ctest|ctest.in)"
color brightcyan "\<(add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_subdirectory|add_test|aux_source_directory|break|build_command|cmake_minimum_required|cmake_policy|configure_file|create_test_sourcelist|define_property|enable_language|enable_testing|execute_process|export|file|find_file|find_library|find_package|find_path|find_program|fltk_wrap_ui|get_cmake_property|get_directory_property|get_filename_component|get_property|get_source_file_property|get_target_property|get_test_property|include|include_directories|include_external_msproject|include_regular_expression|install|link_directories|list|load_cache|load_command|mark_as_advanced|math|message|option|output_required_files|project|qt_wrap_cpp|qt_wrap_ui|remove_definitions|return|separate_arguments|set|set_directory_properties|set_property|set_source_files_properties|set_target_proper
@danlmyers
danlmyers / .gitignore
Created August 2, 2011 03:26 — forked from paigecook/.gitignore
Git Ignore Settings
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@danlmyers
danlmyers / jasonparse.rb
Created March 11, 2012 20:23
Example for the rubygem Json parsing
#!/usr/bin/env ruby
#Simple example of using json ruby gem.
require 'rubygems'
require 'json'
require 'net/http'
def news_search(query, results=10, start=1)
base_url = "http://search.yahooapis.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&output=json"
url = "#{base_url}&query=#{URI.encode(query)}&results=#{results}&start=#{start}"
@danlmyers
danlmyers / humanbytes.py
Created September 9, 2012 14:15
python humanize bytes
#Humanize byte size figures
def humanize_bytes(bytesize, precision=2):
abbrevs = (
(1<<50, 'PB'),
(1<<40, 'TB'),
(1<<30, 'GB'),
(1<<20, 'MB'),
(1<<10, 'kB'),
(1, 'bytes')
)
MAGIC_NUMBERS = {
# List of magic numbers to determine file types.
# A partial Listing is available at: http://en.wikipedia.org/wiki/List_of_file_signatures
'zip': {'numbers': ['\x50\x4B\x03\x04'], 'offset': 0},
'gz': {'numbers': ['\x1F\x8B\x08'], 'offset': 0},
'bz2': {'numbers': ['\x42\x5A\x68'], 'offset': 0},
'tar': {'numbers': ['\x75\x73\x74\x61\x72\x00\x30\x30', '\x75\x73\x74\x61\x72\x20\x20\x00'], 'offset': 257},
'rar': {'numbers': ['\x52\x61\x72\x21\x1A\x07\x00', '\x52\x61\x72\x21\x1A\x07\x01\x00'], 'offset': 0},
'7z': {'numbers': ['\x37\x7A\xBC\xAF\x27\x1C'], 'offset': 0},
'Z': {'numbers': ['\x1F\x9D'], 'offset': 0}
@danlmyers
danlmyers / 0_reuse_code.js
Created January 2, 2016 15:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console