class SomeViewSet(viewsets.ModelViewSet): queryset = models.Some.objects.all() serializer_class = SomeSerializer @detail_route(methods=['post']) @route_permissions('some_app.some_permission') def custom_method(self, request, pk=None):
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
# Sourced from https://github.com/anirbankonar123/CorrosionDetector/blob/master/generate_tfrecord.py | |
""" | |
Usage: | |
# From tensorflow/models/ | |
# Create train data: | |
python3 generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=data/train.record | |
# Create test data: | |
python3 generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=data/test.record | |
""" | |
from __future__ import division |
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 Reactotron from 'reactotron-react-native' | |
import { reactotronRedux } from 'reactotron-redux' | |
var store; | |
if (__DEV__) { | |
Reactotron | |
.configure({ name: 'VTX-sharepoint' }) | |
.use(reactotronRedux()) | |
.connect() |
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
# Install gource from compiling this http://gource.io/ | |
# Install Prereqs like here http://stackoverflow.com/a/15105901/912450 | |
# From here https://github.com/acaudwell/Gource/wiki/Videos#ffmpeg-using-x264-codec | |
./gource --fullscreen -1280x720 -o - --disable-auto-skip --seconds-per-day 0.1 --camera-mode overview --key -r 60 /<path-to-repo>/ | ../ffmpeg/ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4 |
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
""" | |
Some table has two Date fields: expiredate and SALexpiredate | |
Both fields can be null | |
when SALexpiredate is not null, overrides expiredate | |
when ordering: | |
if SALexpiredate is not null, that field needs to be used | |
otherwise fallback to use expiredate | |
""" | |
from django.db.models import DateField, Case, When, F |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
if [ "$(id -u)" != "0" ]; then | |
echo "You must run this script as root." | |
exit 1 | |
fi | |
getaddr1 () { | |
hostname -I | tr " " "\n" | grep 192.168.100; | |
} |
This is a simple autoupdating angular directive to show sparklines in html. Changes on data will auto reflect in GUI.
Requires angularjs and highcharts or highstock.
Usage in html
<span hc-sparkline="data"></span>
in controller
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
// modified from https://gist.github.com/pjsvis/6210002 | |
// Requires jQuery from http://jquery.com/ | |
// and jQuerySparklines from http://omnipotent.net/jquery.sparkline | |
// AngularJS directives for jquery sparkline | |
angular.module('sparkline', []); | |
angular.module('sparkline') | |
.directive('jqSparkline', [function () { |
NewerOlder