Skip to content

Instantly share code, notes, and snippets.

View vandorjw's full-sized avatar

Joost van Dorp vandorjw

View GitHub Profile
@vandorjw
vandorjw / ca_vandorjw_piwik.conf
Created December 16, 2014 19:04
nginx server block for piwik
server {
listen 80;
server_name piwik.vandorjw.ca;
root /srv/piwik/piwik;
index index.php index.html index.htm;
access_log /var/log/nginx/ca/vandorjw/piwik/access.log;
error_log /var/log/nginx/ca/vandorjw/piwik/error.log;
@vandorjw
vandorjw / ca_vandorjw_piwik.ini
Created December 16, 2014 19:02
uwsgi vassal for Piwik
[uwsgi]
project_dir = /srv/piwik/piwik
plugin = php
socket = /run/uwsgi-emperor/%n.sock
chmod-socket = 660
chown-socket = www-data:www-data
uid = www-data
gid = www-data
logto = /var/log/uwsgi/ca_vandorjw_piwik.log
chdir = %(project_dir)
@vandorjw
vandorjw / vassal.ini
Last active August 29, 2015 14:04
uWSGI vassal file
# Using TCP-Sockets
[uwsgi]
projectname = com_example_www
base = /srv/site/com/example/www
chdir = %(base)/src/%(projectname)
pythonpath = %(base)/src/%(projectname)
virtualenv = %(base)/venv/%(projectname)
disable-logging = true
logto = %(base)/logs/uwsgi.log
@vandorjw
vandorjw / Weightronix-SCP-02-python3.4.py
Last active August 29, 2015 14:01
Weightronix SCP-02 python3.4
#!/usr/bin/env python3.4
"""
Short notes and sample code for obtaining weight from Weightronix 6250.
required software:
Linux (any distro will do)
python
pyserial 2.7+
@vandorjw
vandorjw / Tutorial
Last active May 27, 2016 13:52
Centos Nginx Python3.4 uWSGI Emperor
Here are steps:
1. # yum upgrade
2. $ curl -O http://fedora.mirror.nexicom.net/epel/6/i386/epel-release-6-8.noarch.rpm
3. # yum localinstall epel-release-6-8.noarch.rpm
4. $ curl -O http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
5. # yum localinstall pgdg-centos93-9.3-1.noarch.rpm
6. # yum install postgresql93-server postgresql93-contrib postgresql93-devel
7. # service postgresql-9.3 initdb
8. # service postgresql-9.3 start
@vandorjw
vandorjw / Named Config
Last active September 7, 2017 15:44
named config. This is can be used to add private records to a domain.
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
@vandorjw
vandorjw / Fedora 20, Uwsgi, nginx, django, python3
Last active June 23, 2020 02:23
Turn Fedora 20 into Webserver
# This is a step by step tutorial on how to run uwsgi in emperor mode,
# behind nginx on Fedora 20. I'll add to the tutorial as time goes on.
# SeLinux will likely be a pain (even in permissive mode), so please see my comment on how to fix it.
sudo yum upgrade
sudo yum install nano yum-utils gcc uwsgi-plugin-python3 nginx
yum-builddep python3-psycopg2
sudo yum install uwsgi uwsgi-plugins-python3
uwsgi.ini
[uwsgi]
#variables
projectname = vandorjw
base = /var/sites/me/vandorjw
@vandorjw
vandorjw / File-Folder Permissions
Last active January 1, 2016 05:39
File and Folder Permision
sudo groupadd $GRP-NAME
sudo usermod -G $GRP-NAME -a $USR-NAME
setfacl -Rm g:$GRP-NAME,d:g:$GRP-NAME:rwX /top/level/directory/location
For a server not running X we need to have setools-console and optionally fpaste installed.
fpaste will put the results on the fedora pastebin
(| fpaste optional in each command)
(shell) # yum install setools-console
The following seems to check if booleans are set.
(shell) sesearch -ASCT -s httpd_t -t postgresqld_port_t -c tcp_socket -p name_connect | fpaste