This file contains hidden or 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
| upstream example-webpack { | |
| server 127.0.0.1:8080; | |
| } | |
| upstream example-backend { | |
| server 127.0.0.1:3000; | |
| } | |
| server { | |
| listen 80; |
This file contains hidden or 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/bash | |
| pre-commit install | |
| mv .git/hooks/pre-commit .git/hooks/pre-commit-python | |
| cat <<EOF > .git/hooks/pre-commit | |
| #!/bin/bash | |
| source ${VIRTUAL_ENV}/bin/activate | |
| DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
| python \${DIR}/pre-commit-python |
This file contains hidden or 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
| def jsonrpc_registry(cls): | |
| cls.methods = jsonrpcserver.methods.Methods() | |
| for methodname in dir(cls): | |
| method = getattr(cls, methodname) | |
| if hasattr(method, '_rpc'): | |
| cls.methods.add(method) | |
| return cls | |
This file contains hidden or 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
| # Remove local git branches which no longer on remote | |
| git_clean() { | |
| git branch -vv | grep -E ': пропал]|: gone]' | awk '{print $1}' | xargs git branch -d | |
| } | |
| # Wrapper on git flow feature start | |
| feature_start() { | |
| b=${@:2} | |
| git flow feature start "#$1_${b// /_}" | |
| } |
This file contains hidden or 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 rest_framework import serializers | |
| from models.house import House | |
| from models.house_user import HouseUser | |
| from workdays.serializers import WorkdaysSerializer | |
| class TimezoneField(serializers.ChoiceField): | |
| def to_representation(self, value): | |
| return str(value) |
This file contains hidden or 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
| 1. Kill all running containers | |
| docker kill `docker ps -q` | |
| 2. Delete all containers | |
| $ docker ps -q -a | xargs docker rm | |
| -q prints only the container IDs | |
| -a prints all containers |
This file contains hidden or 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 machine import Pin,Timer,PWM | |
| pwm = PWM(Pin(14),100) | |
| polar = 0 | |
| duty = 0 | |
| def setLed(t): |
This file contains hidden or 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
| var app = angular.module("modalFormApp", ['ui.bootstrap']); | |
| app.controller("modalAccountFormController", ['$scope', '$modal', '$log', | |
| function ($scope, $modal, $log) { | |
| $scope.showForm = function () { | |
| $scope.message = "Show Form Button Clicked"; | |
| console.log($scope.message); | |
| var modalInstance = $modal.open({ |
This file contains hidden or 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
| var Text = ' a s d f '; | |
| var cleaned = Text.replace(/\s+/g, ''); |