Skip to content

Instantly share code, notes, and snippets.

@sirwolfgang
sirwolfgang / cstr.c
Last active October 8, 2015 09:18
Char* String To Lower Case
char* strlow(char* _str)
{
for(unsigned int c = 0; _str[c]; _str[c++] = tolower(_str[c]));
return _str;
}
@sirwolfgang
sirwolfgang / swap.c
Last active March 20, 2018 18:09
Single Line Butterfly Swap
void Swap(byte& _A, byte& _B)
{
_A ^= _B ^= _A ^= _B;
}
@sirwolfgang
sirwolfgang / assert.h
Created March 3, 2013 03:51
Custom Asserts
#include <cstdlib>
#undef assert
#ifndef PLATFORM_DEBUG
#define assert(_bCondition)\
do\
{\
(void)sizeof(_bCondition);\
}\
@sirwolfgang
sirwolfgang / .bash_profile
Last active June 7, 2017 21:10
Color Bash Prompts
# Environment
PS1='\[\e[0;32m\]\u@\h\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# Ruby
source /usr/local/opt/chruby/share/chruby/chruby.sh
chruby ruby-2.3.1

Keybase proof

I hereby claim:

  • I am sirwolfgang on github.
  • I am sirwolfgang (https://keybase.io/sirwolfgang) on keybase.
  • I have a public key whose fingerprint is 929A 1F8E 04EF 138C 8D9C 58CB AD77 967E 8271 4C2A

To claim this, I am signing this object:

# /etc/postfix/main.cf
myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains =
virtual_alias_domains = domain.com
virtual_alias_maps = hash:/etc/postfix/virtual
@sirwolfgang
sirwolfgang / httpd.sh
Created December 12, 2014 15:44
Ruby Web Server
ruby -run -e httpd . -p 5000
# frozen_string_literal: true
module ClassCacheKey
extend ActiveSupport::Concern
module ClassMethods
def cache_key(scope = all)
timestamp = DateTime.new(scope.maximum(:updated_at).to_i).utc.to_s(:number)
scope_sql = Digest::SHA1.hexdigest(scope.to_sql)
"#{model_name.cache_key}::#{scope_sql}\##{scope.count}-#{timestamp}"
end
git config --global url."https://".insteadOf git://
{{#if user}}
<%= link_to '{{ user.name }}', "{{ user.profile_path }}" %>
{{else}}
<%= link_to 'Login', new_session_path %> | <%= link_to 'Sign Up', new_user_path %>
{{/if}}