Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:13
installing django 1 on ubuntu14.04 server edition
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/41c55e0c08eda42e2cb3/raw/2c87d853643df5942d00ae9ebe87f8cbe1ac39e3/install.sh)" <mysqlPassword>
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.1.1 djangopythondev djangopythondev
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## see https://vagrantcloud.com/ubuntu/boxes/trusty64
## it should be downloading from https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.99"
config.vm.hostname = "djangopythondev"
#Add any alias:
@simkimsia
simkimsia / cake2-gotchas.md
Last active August 29, 2015 14:11
cake2-gotchas.md

Gotchas

JsonView not displaying json string at all

Please ensure that the data is utf-8 encoded.

If data comes from database, ideally add

'encoding' =&gt; 'utf8'
2g1c
2 girls 1 cup
acrotomophilia
anal
anilingus
anus
arsehole
ass
asshole
assmunch
@simkimsia
simkimsia / sent_detect.R
Created November 15, 2014 10:38
sent_detect function using Maxent_Sent_Token_Annotator
sent_detect <- function(text, language) {
# Function to compute sentence annotations using the Apache OpenNLP Maxent sentence detector employing the default model for language 'en'.
sentence_token_annotator <- Maxent_Sent_Token_Annotator(language)
# Convert text to class String from package NLP
text <- as.String(text)
# Sentence boundaries in text
sentence.boundaries <- annotate(text, sentence_token_annotator)
@simkimsia
simkimsia / index_by_tag.php
Created November 2, 2014 05:29
how to grab one side of many to many entities in Cake 3
<?php
// I have this in BookmarksController
// I am following the bookmarkr tutorial in http://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/intro.html
/**
* Index view by tag method
*
* @return void
@simkimsia
simkimsia / gotchas.md
Last active August 29, 2015 14:08
Gotchas and alerts for those migrating from CakePHP 2 to CakePHP 3

AuthComponent

Cake2

$this->Auth->allow('add', 'index');

Note the lack of array.

Cake3

@simkimsia
simkimsia / OAuth2SecurityConfiguration.java
Created October 26, 2014 15:49
code sample for OAuth2SecurityConfiguration
@Configuration
public class OAuth2SecurityConfiguration {
// This first section of the configuration just makes sure that Spring Security picks
// up the UserDetailsService that we create below.
@Configuration
@EnableWebSecurity
protected static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
@simkimsia
simkimsia / install-cake3-ubuntu-14-04.sh
Last active August 29, 2015 14:07
preparing fresh 14.04 ubuntu install for cake 3
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/4a3808cd109dbd1a3913/raw/d0a9799cdbf0857043b7b59a489361388c09fc4a/install-cake3-ubuntu-14-04.sh)" <mysqlPassword>