Skip to content

Instantly share code, notes, and snippets.

View dbechrd's full-sized avatar

Dan Bechard dbechrd

View GitHub Profile
@dbechrd
dbechrd / BashPrintColor.sh
Last active August 29, 2015 14:02
Some helpful colored output functions that I use in my Git shell scripts on Windows.
CLR='\e[0m'
RED='\e[00;31m'
GREEN='\e[00;32m'
YELLOW='\e[00;33m'
BLUE='\e[00;34m'
PURPLE='\e[00;35m'
CYAN='\e[00;36m'
LIGHTGRAY='\e[00;37m'
@dbechrd
dbechrd / addcommas.c
Created April 11, 2017 19:39
Add commas to string of digits
#include <stdio.h>
#include <string.h>
// Cleanup: This is just for Rodney to see what's happening via printf()
void addCommas_debug(const char *num, char *buffer)
{
char temp[100] = {0};
int src = strlen(num) - 1;
int dst = 0;
@dbechrd
dbechrd / .screenrc-main-example
Last active September 20, 2017 02:54 — forked from ChrisWills/.screenrc-main-example
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Modified by: Dan Bechard dbechrd@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@dbechrd
dbechrd / .vimrc
Created September 20, 2017 02:58
My .vimrc
" maximize window on start
if has("gui_running")
"set lines=999 columns=999
autocmd GUIEnter * simalt ~x
endif
set nocompatible " No vi compatibility
set autoindent " use autoindentation
set autoread " reload changed files automatically
set background=dark " colorscheme will assume dark background
@dbechrd
dbechrd / mustang.vim
Created September 20, 2017 03:00
My Vim colorscheme
" Maintainer: Henrique C. Alves (hcarvalhoalves@gmail.com)
" Version: 1.0
" Last Change: September 25 2008
set background=dark
hi clear
if exists("syntax_on")
syntax reset
bool is_anagram(const char *str1, const char *str2)
{
int char_count[128] = { 0 };
int len = strlen(str1);
for (int i = 0; i < len; i++)
{
if (!str1[i] || !str2[i])
return false;
# Complete the climbingLeaderboard function below.
def climbingLeaderboard(scores, alice)
# Store Alice's position after each game
results = []
# Keep track of Alice's high score so far
alice_max = 0
# For each of Alice's scores
<div class="post-summary">
{{ with .Description }}
{{ (markdownify .) }}
{{ else }}
{{ ((delimit (findRE "(<.*?>(.|\n)*?</.*?>\\s*)+" .Content) "") | truncate (default 200 .Site.Params.summary_length) (default "" .Site.Params.text.truncated ) | replaceRE "&amp;" "&" | safeHTML) }}
{{ end }}
</div>
@dbechrd
dbechrd / vocab.txt
Created September 4, 2019 00:13
A list of words I saw and didn't know the meaning of
nadir
ossification
acme
zenith
selcouth
solivagant
assay
anosmic
fomented
tacit
@dbechrd
dbechrd / spec_trace.rb
Created October 21, 2019 22:46
Ruby trace logger
#----------------------------------------------------------------------------------------
# Example Usage (RSpec)
#----------------------------------------------------------------------------------------
# Define a trace object. Syntax is as follows:
#
# let (:trace) {
# SpecTrace.new({
# Module::ClassA => { exclude: [:method_to_ignore, :another_method_to_ignore] }
# Module::ClassB => { include: [:method_to_trace, :another_method_to_trace] },
# })