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
| /** | |
| * Round robin array iterator | |
| * @param {string | any[]} arr | |
| */ | |
| function* RoundRobinArray(arr) { | |
| let idx = 0; | |
| for (;;) { | |
| yield arr[idx]; | |
| idx++; | |
| if (idx >= arr.length) { |
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
| # in settings.py | |
| REST_AUTH_SERIALIZERS = { | |
| # override dj_rest_auth serializer for 2fa | |
| 'LOGIN_SERIALIZER': 'my_app.serializers.user.LoginSerializer' | |
| } |
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 { TestBed } from '@angular/core/testing'; | |
| import { AppResumeService } from './app-resume.service'; | |
| describe('AppResumeService', () => { | |
| let service: AppResumeService; | |
| beforeEach(() => { | |
| TestBed.configureTestingModule({}); | |
| service = TestBed.inject(AppResumeService); |
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
| urlpatterns = [ | |
| # this path is used to generate email content for password reset request | |
| # from dj-rest-auth API; format is same as used by default django auth so | |
| # the generated URL must be translated to be used with allauth | |
| path('accounts/password/reset/key/api/<uidb64>/<token>/', | |
| user.ApiPasswordResetView.as_view(), | |
| name='password_reset_confirm'), | |
| ] |
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
| let chs = "7b 22 72 65 73 22 3a 22 6c 6f 67 69 6e 22 2c 22 73 74 61 74 22 3a 34 30 33 2c 22 6d 73 67 22 3a 22 43 6f 64 65 20 65 78 70 69 72 65 64 22 7d" | |
| let str = chs.split(" ").map(ch => String.fromCharCode(parseInt(ch, 16))).join("") |
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
| // Base62 encoding / decoding | |
| // Test: `g++ -Wall -g -std=c++11 base4.cpp && ./a.out` | |
| #include <iostream> | |
| #include <algorithm> | |
| #include <time.h> | |
| #include <assert.h> | |
| static const char alphanum[] = | |
| "0123456789" |
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 allauth.account.adapter import DefaultAccountAdapter | |
| from django.contrib.sites.shortcuts import get_current_site | |
| from django.contrib.sites.models import Site | |
| class AccountAdapter(DefaultAccountAdapter): | |
| def get_email_confirmation_url(self, request, emailconfirmation): | |
| """ Override to get domain name from Sites configuration instead of request """ | |
| # when 'request' is empty, the url from Sites is used | |
| try: |
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
| // Insert geoseach JS after leaflet JS files from yii2-leaflet-extension | |
| // https://github.com/2amigos/yii2-leaflet-extension | |
| // https://github.com/smeijer/leaflet-geosearch | |
| $this->registerJsFile('https://unpkg.com/leaflet-geosearch@3.0.0/dist/geosearch.umd.js', [ | |
| 'depends' => [\dosamigos\leaflet\LeafLetAsset::class] | |
| ]); |
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
| // Create a customized SVG pin icon on the fly | |
| // uses vars: lat, lon, color, title | |
| // map is leaflet Map object | |
| const color = '#cc0000'; | |
| const svg = `<?xml version="1.0" encoding="UTF-8"?><svg width="27" height="53.5" version="1.1" viewBox="-31 -22 22 18" xmlns="http://www.w3.org/2000/svg"><path d="m-20 8.8889c-2-20-10-22-10-30a10 10 0 1 1 20 0c0 8-8 10-10 30zm-2-30a2 2 0 1 1 4 0 2 2 0 1 1-4 0" fill="${color}" stroke="#000" stroke-width=".8"/></svg>`; | |
| const iconUrl = 'data:image/svg+xml;base64,' + btoa(svg); | |
| const icon = L.icon({ | |
| iconUrl: iconUrl, | |
| iconAnchor: [13.5, 53], |
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
| MOVED: https://github.com/squio/oneliners/blob/main/pi-hole/pihole-hiseeu-webcam.txt |