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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from raven import Client | |
| client = Client('https://c0615656d179475ba9fc93e60ca3af60:[email protected]:446/2') | |
| # record a simple message | |
| client.captureMessage("hello world from roma с переводом строк\nеще и по русски и очень длинный текст \nи очень длинный текст и очень длинный текст и очень длинный текст и очень длинный текст и очень длинный текст\n ыфвафывафыавфыа") |
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
| <?php | |
| function resizeImage($img, $new_color, $color_range) { | |
| list($width_orig, $height_orig) = getimagesize($img); | |
| $src = imagecreatefrompng($img); | |
| $dst = imagecreatetruecolor($width_orig+50,$height_orig+50); | |
| $pink = imagecolorallocate($dst, 255, 105, 180); | |
| imagefilledrectangle($dst, 15, 50, 150, 150, $pink); | |
| $size_arr = getimagesize($img); | |
| for ($y=0; $y<$size_arr[1]; $y++) { |
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
| # Module: ultrasound.py | |
| # This module can be used to operate an HC-SR04 ultrasonic sensor | |
| # from a raspberry pi GPIO. | |
| import time | |
| import RPi.GPIO as GPIO | |
| # setup which pins are which | |
| TRIG = 8 | |
| ECHO = 7 |
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
| ; supervisor config file | |
| [unix_http_server] | |
| file=/var/run//supervisor.sock ; (the path to the socket file) | |
| chmod=0700 ; sockef file mode (default 0700) | |
| [supervisord] | |
| logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
| pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | |
| childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) |
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
| BaseSensor sensors[] = { | |
| SonicSensor ("s0", 13, 12, 55, 5000, 0), | |
| SonicSensor ("s1", 11, 55, 5000, 0), | |
| SonicSensor ("s2", 10, 55, 5000, 0), | |
| SonicSensor ("s3", 9, 45, 5000, 0), | |
| ButtonSensor ("b01", 8, 10, 100, 0), | |
| ButtonSensor ("b02", 7, 10, 100, 0), | |
| BoolSensor ("m1", 6, 5000, 0), |
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
| // есть базовый класс BaseSensor и есть у него наследники SonicSensor и остальные... | |
| // у них у всех есть public: virtual void init() {} | |
| // я точно проверил, что virtual не забыл | |
| // объявляю все красиво и удобно для меня | |
| BaseSensor sensors[] = { | |
| SonicSensor ("s0", 13, 12, 55, 5000, 0), | |
| SonicSensor ("s1", 11, 55, 5000, 0), | |
| SonicSensor ("s2", 10, 55, 5000, 0), | |
| SonicSensor ("s3", 9, 45, 5000, 0), |
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
| #include <StandardCplusplus.h> | |
| #include <boost_1_51_0.h> | |
| #include <vector> | |
| #include "Arduino.h" | |
| using namespace std; | |
| class BaseSensor { | |
| public: | |
| const char* name; | |
| virtual bool is_sonic() {return false;}; |
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
| Running service: 'http' | |
| 2013-12-19 10:40:35 [24035] [INFO] Starting gunicorn 0.17.2 | |
| 2013-12-19 10:40:35 [24035] [INFO] Listening at: http://127.0.0.1:9000 (24035) | |
| 2013-12-19 10:40:35 [24035] [INFO] Using worker: sync | |
| 2013-12-19 10:40:35 [24046] [INFO] Booting worker with pid: 24046 | |
| 2013-12-19 10:40:35 [24048] [INFO] Booting worker with pid: 24048 | |
| 2013-12-19 10:40:35 [24047] [INFO] Booting worker with pid: 24047 | |
| Internal Server Error: /test/one/ | |
| Traceback (most recent call last): | |
| File "/usr/local/lib/python2.7/dist-packages/Django-1.5.5-py2.7.egg/django/core/handlers/base.py", line 115, in get_response |
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
| .test { | |
| width: 100%; | |
| } | |
| @media only screen and (min-device-width: 480px) { | |
| .test { | |
| width: 90%; | |
| } | |
| } |
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
| public static void permutation() | |
| { | |
| string sourceText = "1bc23a"; | |
| // remove duplicates and sort | |
| string[] s = sourceText.Select(c => c.ToString()).Distinct().OrderBy(c => c).ToArray(); | |
| int combinations = Factorial(s.Length); | |
| int len = s.Length; |
OlderNewer