Skip to content

Instantly share code, notes, and snippets.

View crooksey's full-sized avatar

Luke Crooks crooksey

  • Hampshire, UK
View GitHub Profile
@crooksey
crooksey / material.module.ts
Created September 27, 2018 09:42
material.module.ts
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { CdkTableModule } from '@angular/cdk/table';
import {
MatAutocompleteModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
#!/bin/sh
## Service for traccar.
# PROVIDE: traccar
# REQUIRE: DAEMON
# BEFORE:
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable `traccar':
+ [ -r /etc/rc.conf ]
+ . /etc/rc.conf
+ rc_debug=YES
+ traccar_enable=YES
+ traccar_root=/usr/local/traccar
+ traccar_user=root
+ traccar_java=/usr/local/openjdk7-jre/bin/java
+ sourced_files=:/etc/rc.conf::/etc/rc.conf.local:
+ [ -r /etc/rc.conf.local ]
+ _rc_conf_loaded=true
@crooksey
crooksey / traccar.sh
Created August 20, 2018 11:46
Traccar rc.d
#!/bin/sh
#
# PROVIDE: traccar
# REQUIRE: DAEMON
# BEFORE:
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable `traccar':
#
from celery import Celery
from celery.schedules import crontab
from pyramid_mailer.message import Message
from intranet_backend_api.celery_bundle.celery_settings import mailer
# Define app
app = Celery()
## Broker settings.
broker_url = 'amqp://app_rmq:pass@localhost:5672/intranet'
# Set timezone, for DST
class TAAbsence(BaseRW):
__tablename__= 'ta_absences'
id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey('ta_users.id'), nullable=False)
start_date = Column(Date, nullable=False)
end_date = Column(Date, nullable=False)
# so an example TAAbsence
@crooksey
crooksey / plot_map.py
Last active December 7, 2017 08:59
Plotting map using bounding box
central_lat = sum(lats)/len(lats)
central_lng = sum(lngs)/len(lngs)
bbox = BoundingBox(coords)
map = Basemap(
llcrnrlon=bbox.minx,llcrnrlat=bbox.miny,
urcrnrlon=bbox.maxx,urcrnrlat=bbox.maxy,
resolution='i', projection='tmerc',
lat_0 = central_lat, lon_0 = central_lng)
{
"status": "success",
"total_travel_time": 31.983334,
"total_idle_time": 0,
"num_unserved": 0,
"unserved": null,
"solution": {
"vehicle_1": [
{
"location_id": "depot",
Traceback (most recent call last):
File "/home/luke/virts/as2edi/bin/pserve", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/luke/virts/as2edi/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2927, in <module>
@_call_aside
File "/home/luke/virts/as2edi/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/home/luke/virts/as2edi/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
add_activation_listener(lambda dist: dist.activate())
File "/home/luke/virts/as2edi/lib/python3.5/site-packages/pkg_resources/__init__.py", line 956, in subscribe
import myTemplate from './app.component.html'
@Component({
selector: 'app',
template: myTemplate,
})