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
| # unique_together tuple is ordered in how the name should appear | |
| return ' '.join( | |
| map((lambda v: v.title().replace('-', ' ')), | |
| filter(lambda v: v is not None, [params.get(k, None) for k in self.get_unique_together_field_names()])) | |
| ) |
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
| ubuntu@ip-172-31-16-208:/opt/purify$ celery -A celeryapp.celery beat -l debug | |
| celery beat v3.1.18 (Cipater) is starting. | |
| __ - ... __ - _ | |
| Configuration -> | |
| . broker -> redis://ip-172-31-18-1.us-west-2.compute.internal:6379/1 | |
| . loader -> celery.loaders.app.AppLoader | |
| . scheduler -> celery.beat.PersistentScheduler | |
| . db -> celerybeat-schedule | |
| . logfile -> [stderr]@%DEBUG | |
| . maxinterval -> now (0s) |
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
| import logging | |
| l = logging.getLogger('django.db.backends') | |
| l.setLevel(logging.DEBUG) | |
| l.addHandler(logging.StreamHandler()) |
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
| 20:56:00-edvm~/Work/bomberos.ar/app/baseapp/static (develop)$ cat ~/salida | |
| Active Internet connections (w/o servers) | |
| Proto Recv-Q Send-Q Local Address Foreign Address State | |
| tcp 0 1 192.168.0.12:36542 192.168.0.29:33031 SYN_SENT | |
| tcp 0 0 192.168.0.12:54900 181.30.242.84:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:52610 50.16.248.164:443 ESTABLISHED | |
| tcp 0 1 192.168.0.12:39402 192.168.0.29:37210 SYN_SENT | |
| tcp 0 0 192.168.0.12:49924 64.233.186.113:443 ESTABLISHED | |
| tcp 0 1 192.168.0.12:44746 192.168.0.29:33180 SYN_SENT | |
| tcp 0 1 192.168.0.12:44730 192.168.0.29:33180 SYN_SENT |
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
| 21:02:40-edvm~$ netstat -n | grep ESTABLISHED | |
| tcp 0 0 192.168.0.12:44564 200.42.3.142:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:44500 200.42.3.142:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:39712 181.30.241.226:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:43414 181.30.242.114:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:44558 200.42.3.142:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:44556 200.42.3.142:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:44560 200.42.3.142:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:41802 173.194.42.206:443 ESTABLISHED | |
| tcp 0 0 192.168.0.12:39714 181.30.241.226:443 ESTABLISHED |
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 application.notifications import notify_hipchat | |
| from django.core.cache import cache | |
| from django.utils import timezone | |
| from contextlib import contextmanager | |
| class TaskHandler(object): | |
| def __init__(self, name='celery-tasks', cache=cache): | |
| """TaskHandler |
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
| package main | |
| import "fmt" | |
| func sum(slice *[]int) int { | |
| total := 0 | |
| for _, val := range *slice { | |
| total += val | |
| } | |
| return total |
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
| package main | |
| import "fmt" | |
| func keys(m map[string]int) ([]string, int) { | |
| var keys = []string{} | |
| var c int = 0 | |
| for key, _ := range m { | |
| keys = append(keys, key) | |
| c += 1 |
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. Create a Python function that gets an integer between 1 - 12 (as an hour) and returns the exact time in hours | |
| # and minutes at which the hands of the clock overlap at this hour | |
| # (for example, for 1, the result will be close to 1:06) | |
| # 2. create a unit test for this function, using 'assert', or the Python 'unittest' framework | |
| # 3. [BONUS] | |
| # a. add also seconds calculation to the return value of the function. | |
| # b. calculate the angle of the hands in 360 degrees system | |
| # taking 12:00 (noon, midnight) as a point of reference | |
| # ATTENTION: You do not need to import any modules to implement this task |
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
| Interactive Elixir (1.4.2) - press Ctrl+C to exit (type h() ENTER for help) | |
| iex(1)> [1, 2] | |
| [1, 2] | |
| iex(2)> [9, 10, 2] | |
| [9, 10, 2] | |
| iex(3)> [9, 10] | |
| '\t\n' <-- Whops! Unexpected! |