This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Login to psql and run the following | |
// What is the result? | |
SELECT MAX(id) FROM your_table; | |
// Then run... | |
// This should be higher than the last result. | |
SELECT nextval('your_table_id_seq'); | |
// If it's not higher... run this to try and fix it. (run a quick pg_dump first...) | |
SELECT setval('your_table_id_seq', (SELECT MAX(id) FROM your_table)+1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.config import Configurator | |
from pyramid.authorization import ACLAuthorizationPolicy | |
from pyramid.security import Allow | |
from pyramid.security import Deny | |
from pyramid.security import Everyone, ALL_PERMISSIONS | |
from pyramid.security import ( | |
Authenticated, | |
Everyone, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Service for traccar. | |
# PROVIDE: traccar | |
# REQUIRE: DAEMON | |
# BEFORE: | |
# KEYWORD: shutdown | |
# Add the following lines to /etc/rc.conf to enable `traccar': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ [ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# PROVIDE: traccar | |
# REQUIRE: DAEMON | |
# BEFORE: | |
# KEYWORD: shutdown | |
# Add the following lines to /etc/rc.conf to enable `traccar': | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status": "success", | |
"total_travel_time": 31.983334, | |
"total_idle_time": 0, | |
"num_unserved": 0, | |
"unserved": null, | |
"solution": { | |
"vehicle_1": [ | |
{ | |
"location_id": "depot", |
NewerOlder