Skip to content

Instantly share code, notes, and snippets.

@smotesko
smotesko / all
Created April 1, 2014 08:18
My NGINX config
server {
listen 80 default;
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
index index.html index.htm;
server_name _;
set $hst $host;
if ($host ~ www\.(.*)) { set $hst $1; }
@smotesko
smotesko / refscommit
Created April 9, 2014 12:45
git commit helper for my current job
#! /usr/bin/env php
<?php
// filename: refscommit
/**
* Our git approach is to name branches like "feature/123-description" and commits like
* "refs #123 commitmessage".
* This scripts prepends "refs #number " to the commit message if current git branch is
* "feature/number.*".
* So it helps you by inserting your feature number into the commit message.
@smotesko
smotesko / .bashrc
Last active November 12, 2018 09:43
My .bash_profile
# if .bash_profile on OS X is not sourced, do `ln -s .bash_profile .profile`
alias wow='git status'
export GIT_EDITOR=vim
export VISUAL=vim
export EDITOR=vim
export LC_ALL=C
# brew install bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
@smotesko
smotesko / featcommit
Last active December 28, 2018 08:32
git commit message helper
#! /usr/bin/env php
<?php
// filename: featcommit
/**
*
* This scripts prepends task number to the commit message if current git branch is
* "FOO-xxxx".
* So it helps you by inserting your feature number into the commit message.
* Use it as `featcommit.php "commit message"`.

Keybase proof

I hereby claim:

  • I am smotesko on github.
  • I am smok (https://keybase.io/smok) on keybase.
  • I have a public key whose fingerprint is D11F 088B 398C E148 EBB1 F34E 9AAE F5AB 7681 0700

To claim this, I am signing this object:

@smotesko
smotesko / apache-vhost-vagrant.md
Last active July 21, 2018 08:38
Apache vhost reverse proxy for using Vagrant env on a localhost:80 (Mac)
  • Configure Vagrant box to forward guest port 80 to host port 8001
  • Add vhost to your Apache:
<VirtualHost *:80>
  ServerName projectname.local
  ProxyPass / http://localhost:8001/
  ProxyPassReverse / http://localhost:8001/
  ProxyPreserveHost On
</VirtualHost>
@smotesko
smotesko / .vimrc
Last active November 23, 2017 12:58
set number
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
syntax on
if match($TERM, "screen")!=-1
set term=xterm
endif
@smotesko
smotesko / blueprint
Last active February 14, 2017 12:52
create blueprint image with imagemagick
convert diagram.png -colorspace gray +level-colors white,blue blueprint.png
@smotesko
smotesko / lsusb
Last active February 14, 2017 12:56
lsusb on Mac
system_profiler SPUSBDataType
@smotesko
smotesko / generate-sine.c
Created February 14, 2017 12:54
Generate sine wave
#include <stdio.h>
#include <math.h>
#define NUMBER_OF_SAMPLES 4410 // for 44100 Hz sample rate and 10Hz min f.
#define MAX_VALUE 0xFFFFFF // 24-bit samples
#define MID_VALUE (MAX_VALUE/2)
#define DC_OFFSET (MID_VALUE) // set to 0 for no offset
// Generates a wavetable (a single wavecycle) of a sine wave.
// compile: gcc -o generate-sine generate-sine.c