This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d2x() { | |
printf "%x\\n" $1 | |
} | |
x2d() { | |
echo $((16#$1)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script is used as an "External Build Tool" | |
case $1 in | |
clean) | |
make clean | |
;; | |
*) | |
make -j6 dcb-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let dateFormatter = DateFormatter() | |
let calendar = dateFormatter.calendar! | |
dateFormatter.dateFormat = "MMMM" | |
let now = Date() | |
let nowAsString = dateFormatter.string(from: now) // "November" | |
let september = dateFormatter.date(from: "September")! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if has('win32') || has('win64') | |
set guifont=Consolas:h12:cANSI | |
command! BigFont set guifont=Consolas:h15:cANSI | |
command! SmallFont set guifont=Consolas:h12:cANSI | |
command! TinyFont set guifont=Consolas:h9:cANSI | |
else | |
set guifont=Source\ Code\ Pro\ Light:h15 | |
command! BigFont set guifont=Source\ Code\ Pro\ Light:h18 | |
command! SmallFont set guifont=Source\ Code\ Pro\ Light:h15 | |
command! TinyFont set guifont=Source\ Code\ Pro\ Light:h10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unzip a set of files to archive-specific directories | |
# Example: unz *.zip | |
unz() { | |
if [ -z "$1" ]; then | |
echo 'usage: unz FILE...' | |
else | |
for file in "$@"; do | |
/usr/bin/unzip -d "$file.unz" "$file" | |
done | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Decodes an IOReturn/kern_return_t value. | |
// See https://developer.apple.com/library/content/qa/qa1075/_index.html for details | |
#include <iostream> | |
#include <iomanip> | |
#include <mach/error.h> | |
using std::cout; | |
using std::cerr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a minimal HTML document to standard output | |
newhtml() { | |
cat <<END | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title</title> | |
<!-- <link rel="stylesheet" href="style.css"> --> | |
<!-- <script src="script.js"></script> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To use CodeRunner with .NET Core on a Mac, do this: | |
# | |
# 1. Buy CodeRunner <https://coderunnerapp.com> | |
# 2. Download and install .NET Core SDK from <https://www.microsoft.com/net/learn/get-started/macos> | |
# 3. Launch CodeRunner and open its Preferences | |
# 4. In the Languages pane: | |
# - Select the existing "C#" language (which is for Mono), click the | |
# gear icon at the bottom of the window and choose Duplicate, then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env awk -f | |
# Given a C-like header file, this AWK script will generate a sequence | |
# of case statements for stringifying macro names. | |
# | |
# For example, if the input file looks like this: | |
# | |
# #define kIOReturnSuccess KERN_SUCCESS // OK | |
# #define kIOReturnError iokit_common_err(0x2bc) // general error | |
# #define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
def configure_logging(level=logging.DEBUG): | |
"""Configure the logging module. | |
""" | |
logging.basicConfig( | |
format="%(asctime)s.%(msecs)03d %(levelname)-7s %(message)s", | |
datefmt="%Y-%m-%d %H:%M:%S", | |
level=level) |
OlderNewer