Skip to content

Instantly share code, notes, and snippets.

View rdegraci's full-sized avatar

Rodney Degracia rdegraci

View GitHub Profile
apt-get update
apt-get install -y \
git \
autoconf \
build-essential \
language-pack-en \
libarchive-dev \
libblas-dev \
libboost-all-dev \
Update packages: sudo apt-get update
Install the following packages: apt-get install git build-essential autoconf libtool php5-curl libbison-dev libxml2-dev libssl-dev openssl
Check that your OpenSSL version is now at least 1.0.1 by running: openssl version
Get the libcurl sources, compile, and install:
git clone https://github.com/curl/curl.git
cd curl
# Sync the S3 buckets with public read ACL
aws s3 sync s3://source_bucket s3://target_bucket --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
aws login
# Makes a backup of the heroku database
heroku pg:backups capture --app myapp
# Downloads the backup of the heroku database
curl -o latest.dump `heroku pg:backups public-url --app myapp`
# imports the Heroku postgres database into your local machine's database
/Applications/Postgres.app/Contents/Versions/latest/bin/pg_restore --verbose --clean --no-acl --no-owner -h localhost -U rdegraci -d dev_local_database latest.dump
module_eval
class_eval
module_eval mod.module_eval( aString ) -> anObject
mod.module_eval {| | block } -> anObject
Evaluates the string or block in the context of mod. This can be used to add methods to a class. module_eval returns the result of evaluating its argument.
class Thing
end
a = %q{def hello() "Hello there!" end}
Thing.module_eval(a) » nil
To see a visual diff of all differences between two branches I like to merge the two branches WITHOUT commiting the merge, and then use Git Gui or Git Extensions to get an overview of the differences.
Git command line for merging without commiting:
git checkout branchA
git merge --no-commit --no-ff branchB
shareedit
answered May 28 '13 at 11:29
Tormod Hystad
@interface ManagedObjectCloner : NSObject {
}
+(NSManagedObject *)clone:(NSManagedObject *)source inContext:(NSManagedObjectContext *)context;
@end
@implementation ManagedObjectCloner
+(NSManagedObject *) clone:(NSManagedObject *)source inContext:(NSManagedObjectContext *)context{
# install java 8
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
java -version
# install elasticsearch
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.5/elasticsearch-2.3.5.deb
sudo dpkg -i elasticsearch-2.3.5.deb
sudo update-rc.d elasticsearch defaults
train_set = [ # A AND NOT B
[0,0,0],
[0,1,0],
[1,0,1],
[1,1,0],
]
n=30
layers = [2, 2, 1]
--
-- Rodney Degracia
--
-- July 2014
--
-- Script to find the frequency of books published each year
--
-- http://www2.informatik.uni-freiburg.de/~cziegler/BX/
--
--