Skip to content

Instantly share code, notes, and snippets.

View smolin's full-sized avatar

Steve Molin smolin

View GitHub Profile
@smolin
smolin / buildDjango.ansible
Last active September 28, 2017 20:52
'django startproject' yields simplest working project; this Ansible playbook adds a bunch more steps, mostly from the official tutorial.
# Ansible Playbook
#
# This will create a new Django project with a single app; and will add files and set
# stuff up to demonstrate a Template, a Model, a Migration, and Url includes.
#
# you must have django-admin in your PATH, probably via virtualenv, to make this work
#
# By Steve Molin. GPL.
---
- hosts: all
@smolin
smolin / howto_smartd.txt
Last active September 27, 2017 14:44
monitor a disk drive in linux using smartd and send reports with email
In /etc/smartd.conf, add a line like this before the line with DEVICESCAN in it:
/dev/sda -m your_email@domain.com -M test
The "-M test" says to send an email when smartd starts (in order to test the
email channel).
@smolin
smolin / howto_ssmtp.txt
Created August 11, 2017 20:07
send email from linux with ssmtp
These instructions will allow root to send email from the
system through a dedicated gmail account, as for example for
smartd monitoring.
Props to https://tecadmin.net/send-email-smtp-server-linux-command-line-ssmtp/
for the starting point for this information.
Sign up for a dedicated gmail account.
Turn on "allow less secure apps".
@smolin
smolin / cheat_java.txt
Created March 6, 2017 16:33
Simple Java Cheat Sheet
# Hello World
public class YourName {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
# Fundamental data types and examples
int 99 boolean true char 'a'
@smolin
smolin / cheat_sql.txt
Last active December 20, 2023 01:11
simple SQL cheatsheet
# props to codecademy.org for great interactive intro to SQL
# CREATE
CREATE TABLE mytable...
CREATE TABLE mytable(id INTEGER PRIMARY KEY, name TEXT);
# a "foreign key" is a reference to a "primary key" in another table
# INSERT
INSERT INTO mytable ...
@smolin
smolin / cheat_ruby.rb
Last active February 22, 2017 02:33
a simple cheatsheet for ruby
# constants
MYCONSTANT = 123
# strings
myString = 'a b c'
myString = "a b c #{expression}'
# lists
myList = [1,2,3,4,5]
# some methods of list: