Skip to content

Instantly share code, notes, and snippets.

View shovon's full-sized avatar
💻
Working on my own projects

Sal Rahman shovon

💻
Working on my own projects
View GitHub Profile
@shovon
shovon / thin-fonts.sh
Created January 17, 2013 01:19
Font rendering on Mac OS X is ugly. This single line should fix it.
# Fix font rendering on Mac OS X.
$ defaults -currentHost write -globalDomain AppleFontSmoothing -int 0
@shovon
shovon / octal.coffee
Last active December 12, 2015 06:28
Circumventing "octal escape sequences are not allowed" errors in CoffeeScript.
bold = `'\033[0;1m'`
green = `'\033[0;32m'`
reset = `'\033[0m'`
red = `'\033[0;31m'`
# Thanks to https://github.com/gradus/black-coffee/issues/1#issuecomment-6319861
@shovon
shovon / gist:5728555
Last active December 18, 2015 04:49
Pretty print git logs. Better than gitk.
# Create a git alias that will pretty-print your git logs. Much better than
# firing up `gitk`.
#
# From https://coderwall.com/p/euwpig#comment_3248
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
# And then, you should be able to view the logs like so:
git lg
@shovon
shovon / README.md
Last active April 18, 2019 08:37
An install script for LLVM and Clang v3.2.

Installing LLVM and Clang v3.2 on OS X

I'm assuming you need this version for Emscripten.

Don't worry, this script will not override your current installation of LLVM and Clang.

Be sure that you have:

  • read this README file
  • read this README file
@shovon
shovon / .bash_profile
Last active December 21, 2015 13:59
Adds a fancy theme to the default bash shell.
# Some commonly used colors.
bash_reset_color='\[\e[0m\]'
bash_red='\[\e[0;31m\]'
bash_green='\[\e[0;32m\]'
bash_yellow='\[\e[0;33m\]'
bash_blue='\[\e[0;34m\]'
bash_purple='\[\e[0;35m\]'
bash_cyan='\[\e[0;36m\]'
# Displays the top-level direcory of the currently working directory.
@shovon
shovon / disqus-mixin.jade
Last active December 23, 2015 02:19
A Jade mixin to embed Disqus onto your Jade-powered site.
mixin disqus(shortname)
#disqus_thread
script.
var disqus_shortname = '#{shortname}';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
@shovon
shovon / gist:8359005
Created January 10, 2014 17:45
Nginx server settings, where only requests to example.com will be processed, and everything else will simply result in a no response.
server {
listen 80 default_server;
return 444;
}
server {
listen 80;
server_name example.com;
root /var/www/example.com;
@shovon
shovon / docker.conf
Created June 17, 2014 16:28
This is a modification of the original Upstart script. It is intended for those that get the latest binary downloads.
description "Docker daemon"
start on filesystem
stop on runlevel [!2345]
respawn
pre-start script
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
@shovon
shovon / gist:34b14e5c4213d51e4176
Created June 23, 2014 16:25
Upstart job for any Node.js application, with Node.js versions managed using NVM.
description "<Application name here>"
start on runlevel [23]
stop on shutdown
script
cd <path/to/project/here>
export NODE_ENV=production
# Be sure to have a `start` script in your `package.json`
<path/to>/.nvm/<version number>/bin/npm start
@shovon
shovon / Dockerfile
Last active August 29, 2015 14:02
Download and install Redis from source, in Docker
FROM ubuntu:14.04
RUN apt-get update; apt-get install -y wget build-essential
RUN wget http://download.redis.io/releases/redis-2.8.12.tar.gz
RUN tar xvfz redis-2.8.12.tar.gz
RUN cd redis-2.8.12; make; chmod +x $PWD/src/redis-server; ln -s $PWD/src/redis-server /usr/bin/redis-server
EXPOSE 6379
CMD [ "redis-server", "--bind", "0.0.0.0" ]