Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Bengtsson peterbe

View GitHub Profile
View test.yml
name: Hi
on:
workflow_dispatch:
inputs:
version:
required: false
default: ''
schedule:
- cron: '20 */4 * * *'
View peterbe__debug_302-bad-redirects.py
import requests
import time
def run(path):
r = requests.get(f'https://docs.github.com{path}', allow_redirects=False)
assert r.status_code == 302, r.status_code
# print(r.status_code)
# print(r.headers.get('x-cache'))
if 'HIT' in r.headers.get('x-cache'):
View MostCommon.py
#!/usr/bin/env python
import argparse
import sys
from collections import Counter
def main(paths, n=100):
counter = Counter()
for path in paths:
print(path)
View productGroups.json
[{"name":"Get started","icon":null,"octicon":"RocketIcon","children":[{"id":"get-started","name":"Get started","href":"/get-started","dir":"content/get-started","toc":"content/get-started/index.md","wip":false,"hidden":false,"versions":["free-pro-team@latest","enterprise-cloud@latest","enterprise-server@3.6","enterprise-server@3.5","enterprise-server@3.4","enterprise-server@3.3","enterprise-server@3.2","github-ae@latest"]},{"id":"account-and-profile","name":"Account and profile","href":"/account-and-profile","dir":"content/account-and-profile","toc":"content/account-and-profile/index.md","wip":false,"hidden":false,"versions":["free-pro-team@latest","enterprise-cloud@latest","enterprise-server@3.6","enterprise-server@3.5","enterprise-server@3.4","enterprise-server@3.3","enterprise-server@3.2","github-ae@latest"]},{"id":"authentication","name":"Authentication","href":"/authentication","dir":"content/authentication","toc":"content/authentication/index.md","wip":false,"hidden":false,"versions":["free-pro-team@lat
View default.txt
assets/images/enterprise/3.0/dependabot-alert-dismiss.png
assets/images/enterprise/3.0/dependabot-alert-info.png
assets/images/enterprise/3.0/organizations/security-and-analysis-enable-or-disable-secret-scanning-checkbox.png
assets/images/enterprise/maintenance/ip-exception-enabled.png
assets/images/enterprise/management-console/sidebar-advanced-security.png
assets/images/enterprise/repository/dependabot-alert-dismiss-drop-down.png
assets/images/enterprise/site-admin-settings/repository-creation-drop-down.png
assets/images/help/billing/actions-packages-report-download-org.png
assets/images/help/branches/branch-creation-popup-fork.png
assets/images/help/branches/branch-creation-popup.png
View peterbe__analyze-includeGuides.py
import requests
from collections import Counter
paths = []
with open('content/admin/guides.md') as f:
record = False
for line in f:
if line.startswith('includeGuides:'):
record = True
continue
View peterbe__search-in-langs-and-versions.py
import time
from urllib.parse import urlencode
import requests
langs = ('en', 'cn', 'es', 'ja', 'pt')
versions = ('dotcom', 'ghec', '3.6', '3.5', '3.3', '3.4', '3.2', 'ghae')
for lang in langs:
View default.diff
diff --git a/package-lock.json b/package-lock.json
index 6e91c6c87b1..4dbfa9f8eaa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20453,6 +20453,201 @@
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
+ },
+ "node_modules/@next/swc-android-arm-eabi": {
View default.diff
diff --git a/components/Search.tsx b/components/Search.tsx
index 5bffca38715..80a07dd66af 100644
--- a/components/Search.tsx
+++ b/components/Search.tsx
@@ -9,6 +9,8 @@ import { useTranslation } from 'components/hooks/useTranslation'
import { sendEvent, EventType } from 'components/lib/events'
import { useMainContext } from './context/MainContext'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
+import { useRecentSearches } from 'components/hooks/useRecentSearches'
+import type { RecentSearch } from 'components/hooks/useRecentSearches'
View default.js
import got from 'got'
main()
async function main() {
const URLS = [
'https://www.peterbe.com',
'https://docs.github.com/en',
'https://developer.mozilla.org',
'https://primer.style/',
]