sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- Download zsh-autosuggestions by
| javascript:(function(){ad = [...document.querySelectorAll('.ad-showing')][0]; if(ad != null) { video = document.querySelector('video'); video.currentTime = video.duration; }})(); |
| javascript:(()=>{ | |
| var shitFlowIds = ['flow-config-empowerment', 'flow-config-genre-kpop', 'flow-config-genre-pop']; | |
| shitFlowIds.forEach(flow => (document.querySelector(`[data-testid="${flow}"]`).parentElement.remove())); | |
| })(); |
| class TimeLimitedPaginator(Paginator): | |
| """ | |
| Paginator that enforced a timeout on the count operation. | |
| When the timeout is reached a "fake" large value is returned instead, | |
| Why does this hack exist? On every admin list view, Django issues a | |
| COUNT on the full queryset. There is no simple workaround. On big tables, | |
| this COUNT is extremely slow and makes things unbearable. This solution | |
| is what we came up with. | |
| """ |
| import random | |
| def simulate(num_tokens_to_pick, black_tokens, white_tokens): | |
| picked_tokens = [] | |
| for _ in range(min(num_tokens_to_pick, black_tokens)): | |
| picked_tokens.append("black") | |
| black_tokens -= 1 | |
| num_tokens_to_pick -= 1 |
| from rest_framework.routers import DefaultRouter | |
| class OptionalTraillingSlashRouter(DefaultRouter): | |
| def __init__(self, trailing_slash=True): | |
| super().__init__(trailing_slash) | |
| self.trailing_slash = "/?" | |
| def get_lookup_regex(self, viewset): | |
| base_regex = '(?P<{lookup_field}>[^/.]+)' | |
| lookup_field = getattr(viewset, 'lookup_field', 'pk') |
| ''' | |
| Response example: | |
| { | |
| "bestemmia": "DIO CANE", | |
| "count": 2 | |
| } | |
| ''' | |
| response = requests.get(BASE_URL.format(endpoint="random")) | |
| response.raise_for_status() |
| import requests | |
| BASE_URL = "http://bestemmie.org/api/{endpoint}" | |
| params = { | |
| "bestemmia": "Dio cane" | |
| } | |
| response = requests.post(BASE_URL.format(endpoint="bestemmie/"), params) | |
| response.raise_for_status() | |
| ''' | |
| Return 204 no content |
| import requests | |
| BASE_URL = "http://bestemmie.org/api/{endpoint}" | |
| ''' | |
| Optional params: | |
| offset (default 50) | |
| limit (default 50) | |
| Response field: | |
| count: total distinct count of bestemmie |
| import requests | |
| BASE_URL = "http://bestemmie.org/api/{endpoint}" | |
| # GET ALL BESTEMMIE | |
| # ENDPOINT: /bestemmie | |
| ''' | |
| Method: GET | |
| Optional params: |