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
int save_frame_as_jpeg(AVCodecContext *pCodecCtx, AVFrame *pFrame, int FrameNo) { | |
AVCodec *jpegCodec = avcodec_find_encoder(AV_CODEC_ID_JPEG2000); | |
if (!jpegCodec) { | |
return -1; | |
} | |
AVCodecContext *jpegContext = avcodec_alloc_context3(jpegCodec); | |
if (!jpegContext) { | |
return -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
#!/usr/bin/env bash | |
# Pre-requisites | |
sudo apt-get -y update | |
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim | |
# Download and compile Ruby 2.1.3 | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.3.tar.gz | |
tar -xvzf ruby-2.1.3.tar.gz |
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
# Install Git needed for Git based gems | |
packages: | |
yum: | |
git: [] | |
I've been using this technique in most of my Ruby projects lately where Ruby versions are required:
- Create
.rbenv-version
containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far... - Create
.rvmrc
(withrvm --create --rvmrc "1.9.3@myapp"
) and edit theenvironment_id=
line to fetch the Ruby version from.rbenv-version
(example below).
Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version
.
Tired of waiting for emacs to start on OS X? This step by step guide will
teach you how to install the latest version of emacs and configure it to start
in the background (daemon mode) and use emacsclient
as your main editor.
First you'll need to install the [Homebrew package manager][brew] if yo haven't already. It is amazing.
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
def write(text="") | |
puts text | |
end | |
def say(message, subitem=false) | |
write "#{subitem ? " ->" : "--"} #{message}" | |
end | |
def say_custom(tag, text) | |
say "\033[1m\033[36m" + tag.to_s.rjust(10) + "\033[0m" + " #{text}" |
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
server{ | |
listen 80; #or change this to your public IP address eg 1.1.1.1:80 | |
server_name wordpress; #change this to the domain name, for example www.myblog.com | |
access_log /var/log/wordpress.access_log; | |
error_log /var/log/wordpress.error_log; | |
location / { | |
root /home/your-user-name/Sites/wordpress; | |
index index.php index.html index.htm; |
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
mysql -u root -p | |
mysql> create user blog@localhost identified by 'password'; | |
mysql> create database blog; | |
mysql> grant all on blog.* to blog@localhost; | |
mysql> exit; |
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
bundle install |