Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / table.php
Last active October 9, 2015 10:16
bootstrap 3 table
<table class="table table-striped table-borderless table-vcenter" style="table-layout:fixed;">
<tbody>
<?php foreach ($cartData as $id => $item) : ?>
<?php $hash = 'post_' . hash('md5', $id); ?>
<tr>
<form name="<?= $hash ?>" action="cart.php" method="POST">
<input type="hidden" value="<?= $id ?>" name="id" />
<input type="hidden" value="remove" name="action" />
</form>
<td class="col-md-1 text-center">
@simkimsia
simkimsia / README.md
Last active August 29, 2015 14:26
pg_hba.conf for 9.3 so that I can access via TCP/IP connection over remote connection

how to use postgres

By default, should never change the postgres user password

See http://serverfault.com/a/325596/61030

To access the database as postgres,

  1. go into the server
  2. use sudo -u postgres psql postgres
@simkimsia
simkimsia / readme.md
Last active August 29, 2015 14:23
How to develop and deploy django 1.8

develop and deploy django

First we consider the development environment.

It will be done using virtualbox + vagrant + ubuntu14.04

  1. Inside develop environment nginx (install using ubuntu repositories):
########################################
pm WARN package.json starter-kit@0.0.1 No repository field.
npm WARN deprecated css-sprite@0.9.9: css-sprite is now called sprity
npm WARN optional dep failed, continuing fsevents@0.3.6
> spawn-sync@1.0.11 postinstall /var/virtual/WebApps/kstest/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/node_modules/bin-wrapper/node_modules/bin-check/node_modules/spawn-sync
> node postinstall
> spawn-sync@1.0.11 postinstall /var/virtual/WebApps/kstest/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/bin-check/node_modules/spawn-sync
> node postinstall
@simkimsia
simkimsia / docker commands.sh
Last active August 29, 2015 14:20
useful bash commands for docker
#remove all containers
docker rm $(docker kill $(docker ps -a -q))
docker rmi image_id #where image_id is the id of the specific image you want to remove
docker ps -a # Lists all containers
docker build -t django18-python27-ubuntu1404 . ## build docker reponame dockerfilepath
docker run -ti django18-python27-ubuntu1404 sh ## run the docker and go in
@simkimsia
simkimsia / README.md
Last active June 27, 2017 22:59
How to setup Ubuntu 14.04 for Python Django

How to setup Ubuntu 14.04 server for Python Django Web App

Assuming you are in root

Make sure the locale is set to UTF-8

locale-gen UTF-8

Create a .bash_profile in the ~/ with the following entries

@simkimsia
simkimsia / browser-test.png
Last active August 29, 2015 14:15
django configs
browser-test.png
@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:15
Even better installation script for server that will support the django application, the front end and the database for different python environment
#!/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>
@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:15
A better installation script for python django in ubuntu
#!/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>
@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>