create user:
CREATE ROLE username WITH LOGIN PASSWORD 'password';
show users:
\du
create database:
CREATE DATABASE databasename;
show databases:
| from django.template.defaultfilters import stringfilter | |
| from django.utils.safestring import mark_safe | |
| from django import template | |
| register = template.Library() | |
| @register.filter | |
| @stringfilter | |
| def zerowidthspace_separator(value, num): | |
| """ |
| var dfd_arr = []; // array of deferred objects | |
| var get_dfd1 = function(){ | |
| var dfd1 = $.Deferred(); | |
| var req = $.ajax({ | |
| success: dfd1.resolve, | |
| }); | |
| req.done(function(){ // dfd1 success callback |
| L = [100, 120, 100]. | |
| lists:flatten([io_lib:format("~c", [V]) || V <- L]). |
| #!/usr/bin/env python | |
| # | |
| # Purpose: This script strips out all the geo latitude + longitude data | |
| # from JPG / JPEG files | |
| # | |
| # Installation: Make sure you have PIL (Python Imaging Library), or "Pillow" | |
| # | |
| # Usage: Put this file in directory with photos and run it from there | |
| # | |
| # e.g. |
| # 1. install aouyar's healthgraph-api (via pip install or git clone. see his instructions) | |
| # 2. signup on Runkeeper.com (as developer, not end user) as an RK app, to get client secret and key | |
| # 3. fire up the self contained web server (bottle and beaker), installing dependencies as needed (about 1 or 2) | |
| # 4. from previous step, you should get the user's access token | |
| import healthgraph | |
| access_token = "xxxxxxxxx" # enter your user access token here | |
| session = healthgraph.Session(access_token) |
| def groupme_springhaus_ops(request): | |
| if settings.ENABLE_GROUPME_OPS == False: | |
| return Http404 | |
| url = "https://api.groupme.com/v3/groups/" + settings.GROUPME_SPRINGHAUS_CORE_GROUP_ID_KEY + "/messages" | |
| gmc = GroupMeControl.objects.all()[0] | |
| last_seen_message_id = gmc.last_seen_id_str | |
| print("starting ops. Last message id is: " + gmc.last_seen_id_str) |
| // | |
| // parseViewController.swift | |
| // parseTest | |
| // | |
| // Created by Jay Liew on 6/23/17. | |
| // Copyright © 2017 Jay Liew. All rights reserved. | |
| // | |
| /* | |
| _____ __ _ __ ____ __ | |
| /\ '__`\ /'__`\ /\`'__\/',__\ /'__`\ |
create user:
CREATE ROLE username WITH LOGIN PASSWORD 'password';
show users:
\du
create database:
CREATE DATABASE databasename;
show databases:
| [Unit] | |
| Description=SSH Tunnel for MySQL | |
| After=network.target | |
| [Service] | |
| Restart=always | |
| RestartSec=20 | |
| User=unprivilegedusername | |
| ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -L 3306:127.0.0.1:3306 username@hostactuallyrunningmysqld |
| # Props to user brechmos for sharing the code here: https://www.raspberrypi.org/forums/viewtopic.php?t=55100 | |
| # Tested with the following barcode scanner | |
| # macbook# ioreg -p IOUSB | |
| # <snip> | |
| # | +-o WIT 122-UFS V2.03@14200000 <class AppleUSBDevice, id 0x10000c3c4, registered, matched, active, busy 0 (6 ms), retain 14> | |
| # WIT 122-UFS V2.03: | |
| # Product ID: 0x1010 | |
| # Vendor ID: 0x05fe (CHIC TECHNOLOGY CORP) |