Skip to content

Commit

Permalink
Site updated: 2024-08-04 07:20:57
Browse files Browse the repository at this point in the history
  • Loading branch information
narutozxp committed Aug 4, 2024
1 parent de9fdba commit 8e1d6be
Show file tree
Hide file tree
Showing 147 changed files with 53,380 additions and 0 deletions.
686 changes: 686 additions & 0 deletions 2022/05/02/抽象代数之基本概念/index.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
298 changes: 298 additions & 0 deletions 2022/05/10/VTR/index.html

Large diffs are not rendered by default.

762 changes: 762 additions & 0 deletions 2022/05/19/test/index.html

Large diffs are not rendered by default.

775 changes: 775 additions & 0 deletions 2022/05/21/VTR-Architecture-Reference-XML/index.html

Large diffs are not rendered by default.

293 changes: 293 additions & 0 deletions 2022/06/06/FROM-VPR-TO-OPENFPGA/index.html

Large diffs are not rendered by default.

3,367 changes: 3,367 additions & 0 deletions 2022/07/05/ML-Theory-Summary/index.html

Large diffs are not rendered by default.

Binary file added 2022/07/05/ML-Theory-Summary/originVSdual.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file added 2022/07/22/PyTorch-Abstract/cifar10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
531 changes: 531 additions & 0 deletions 2022/07/22/PyTorch-Abstract/index.html

Large diffs are not rendered by default.

Binary file added 2022/07/22/PyTorch-Abstract/mnist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541383178746.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541383817248.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541384140042.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541384366413.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541384818688.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541673704101.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541676003486.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541748375356.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541905327273.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1541905559138.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1544861202252.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545017602518.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545533548532.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545533829184.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545881904150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545882158050.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1545985945198.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2022/11/28/c-plus-plus-summary/1547103297864.png
Binary file added 2022/11/28/c-plus-plus-summary/1547103359158.png
Binary file added 2022/11/28/c-plus-plus-summary/1547105026929.png
Binary file added 2022/11/28/c-plus-plus-summary/1547606785041.png
Binary file added 2022/11/28/c-plus-plus-summary/clip_image002.jpg
Binary file added 2022/11/28/c-plus-plus-summary/clip_image002.png
4,260 changes: 4,260 additions & 0 deletions 2022/11/28/c-plus-plus-summary/index.html

Large diffs are not rendered by default.

Binary file added 2022/11/28/c-plus-plus-summary/timg.gif
Binary file added 2022/11/28/c-plus-plus-summary/三只小猪.jpg
Binary file added 2022/11/28/c-plus-plus-summary/猜数字.jpg
571 changes: 571 additions & 0 deletions 2024/05/10/The-Art-of-Command-Line/index.html

Large diffs are not rendered by default.

691 changes: 691 additions & 0 deletions 2024/05/14/计算机数值表示/index.html

Large diffs are not rendered by default.

631 changes: 631 additions & 0 deletions 2024/07/29/WaveDrom/index.html

Large diffs are not rendered by default.

561 changes: 561 additions & 0 deletions 2024/07/31/CRC校验详解/index.html

Large diffs are not rendered by default.

236 changes: 236 additions & 0 deletions about/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2022/05/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2022/06/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2022/07/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2022/11/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2022/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2024/05/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2024/07/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/2024/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions archives/page/2/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/CAD/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/CRC/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/CS/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/IC/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/ML/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/Plot/WaveDrom/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/Plot/index.html

Large diffs are not rendered by default.

233 changes: 233 additions & 0 deletions categories/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions categories/math/index.html

Large diffs are not rendered by default.

458 changes: 458 additions & 0 deletions css/custom.css

Large diffs are not rendered by default.

728 changes: 728 additions & 0 deletions css/font.css

Large diffs are not rendered by default.

6,102 changes: 6,102 additions & 0 deletions css/index.css

Large diffs are not rendered by default.

File renamed without changes.
Binary file added img/0.jpg
Binary file added img/00.jpg
Binary file added img/1.jpg
Binary file added img/10.jpg
Binary file added img/11.jpg
Binary file added img/12.jpg
Binary file added img/13.jpg
Binary file added img/14.jpg
Binary file added img/15.jpg
Binary file added img/16.jpg
Binary file added img/17.jpg
Binary file added img/18.jpg
Binary file added img/19.jpg
Binary file added img/2.jpg
Binary file added img/20.jpg
Binary file added img/21.jpg
Binary file added img/22.jpg
Binary file added img/23.jpg
Binary file added img/24.jpg
Binary file added img/25.jpg
Binary file added img/26.jpg
Binary file added img/27.jpg
Binary file added img/28.jpg
Binary file added img/29.jpg
Binary file added img/3.jpg
Binary file added img/30.jpg
Binary file added img/4.jpg
Binary file added img/404.jpg
Binary file added img/5.jpg
Binary file added img/6.jpg
Binary file added img/7.jpg
Binary file added img/8.jpg
Binary file added img/9.jpg
Binary file added img/favicon.png
Binary file added img/friend_404.gif
Binary file added img/myself.jpg
455 changes: 455 additions & 0 deletions index.html

Large diffs are not rendered by default.

780 changes: 780 additions & 0 deletions js/main.js

Large diffs are not rendered by default.

155 changes: 155 additions & 0 deletions js/search/algolia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
window.addEventListener('load', () => {
const openSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = '100%'
bodyStyle.overflow = 'hidden'
btf.animateIn(document.getElementById('search-mask'), 'to_show 0.5s')
btf.animateIn(document.querySelector('#algolia-search .search-dialog'), 'titleScale 0.5s')
setTimeout(() => { document.querySelector('#algolia-search .ais-SearchBox-input').focus() }, 100)

// shortcut: ESC
document.addEventListener('keydown', function f (event) {
if (event.code === 'Escape') {
closeSearch()
document.removeEventListener('keydown', f)
}
})
}

const closeSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = ''
bodyStyle.overflow = ''
btf.animateOut(document.querySelector('#algolia-search .search-dialog'), 'search_close .5s')
btf.animateOut(document.getElementById('search-mask'), 'to_hide 0.5s')
}

const searchClickFn = () => {
document.querySelector('#search-button > .search').addEventListener('click', openSearch)
}

const searchClickFnOnce = () => {
document.getElementById('search-mask').addEventListener('click', closeSearch)
document.querySelector('#algolia-search .search-close-button').addEventListener('click', closeSearch)
}

const cutContent = content => {
if (content === '') return ''

const firstOccur = content.indexOf('<mark>')

let start = firstOccur - 30
let end = firstOccur + 120
let pre = ''
let post = ''

if (start <= 0) {
start = 0
end = 140
} else {
pre = '...'
}

if (end > content.length) {
end = content.length
} else {
post = '...'
}

let matchContent = pre + content.substring(start, end) + post
return matchContent
}

const algolia = GLOBAL_CONFIG.algolia
const isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName
if (!isAlgoliaValid) {
return console.error('Algolia setting is invalid!')
}

const search = instantsearch({
indexName: algolia.indexName,
searchClient: algoliasearch(algolia.appId, algolia.apiKey),
searchFunction(helper) {
helper.state.query && helper.search()
},
})

const configure = instantsearch.widgets.configure({
hitsPerPage: 5
})

const searchBox = instantsearch.widgets.searchBox({
container: '#algolia-search-input',
showReset: false,
showSubmit: false,
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder,
showLoadingIndicator: true
})

const hits = instantsearch.widgets.hits({
container: '#algolia-hits',
templates: {
item(data) {
const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
return `
<a href="${link}" class="algolia-hit-item-link">
${data._highlightResult.title.value || 'no-title'}
</a>
<p class="algolia-hit-item-content">${cutContent(data._highlightResult.contentStripTruncate.value)}</p>`
},
empty: function (data) {
return (
'<div id="algolia-hits-empty">' +
GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
'</div>'
)
}
}
})

const stats = instantsearch.widgets.stats({
container: '#algolia-info > .algolia-stats',
templates: {
text: function (data) {
const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
.replace(/\$\{hits}/, data.nbHits)
.replace(/\$\{time}/, data.processingTimeMS)
return (
`<hr>${stats}`
)
}
}
})

const powerBy = instantsearch.widgets.poweredBy({
container: '#algolia-info > .algolia-poweredBy',
})

const pagination = instantsearch.widgets.pagination({
container: '#algolia-pagination',
totalPages: 5,
templates: {
first: '<i class="fas fa-angle-double-left"></i>',
last: '<i class="fas fa-angle-double-right"></i>',
previous: '<i class="fas fa-angle-left"></i>',
next: '<i class="fas fa-angle-right"></i>'
}
})


search.addWidgets([configure,searchBox,hits,stats,powerBy,pagination]) // add the widgets to the instantsearch instance

search.start()

searchClickFn()
searchClickFnOnce()

window.addEventListener('pjax:complete', () => {
getComputedStyle(document.querySelector('#algolia-search .search-dialog')).display === 'block' && closeSearch()
searchClickFn()
})

window.pjax && search.on('render', () => {
window.pjax.refresh(document.getElementById('algolia-hits'))
})
})
188 changes: 188 additions & 0 deletions js/search/local-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
window.addEventListener('load', () => {
let loadFlag = false
let dataObj = []
const $searchMask = document.getElementById('search-mask')

const openSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = '100%'
bodyStyle.overflow = 'hidden'
btf.animateIn($searchMask, 'to_show 0.5s')
btf.animateIn(document.querySelector('#local-search .search-dialog'), 'titleScale 0.5s')
setTimeout(() => { document.querySelector('#local-search-input input').focus() }, 100)
if (!loadFlag) {
search()
loadFlag = true
}
// shortcut: ESC
document.addEventListener('keydown', function f (event) {
if (event.code === 'Escape') {
closeSearch()
document.removeEventListener('keydown', f)
}
})
}

const closeSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = ''
bodyStyle.overflow = ''
btf.animateOut(document.querySelector('#local-search .search-dialog'), 'search_close .5s')
btf.animateOut($searchMask, 'to_hide 0.5s')
}

const searchClickFn = () => {
document.querySelector('#search-button > .search').addEventListener('click', openSearch)
}

const searchClickFnOnce = () => {
document.querySelector('#local-search .search-close-button').addEventListener('click', closeSearch)
$searchMask.addEventListener('click', closeSearch)
if (GLOBAL_CONFIG.localSearch.preload) dataObj = fetchData(GLOBAL_CONFIG.localSearch.path)
}

// check url is json or not
const isJson = url => {
const reg = /\.json$/
return reg.test(url)
}

const fetchData = async (path) => {
let data = []
const response = await fetch(path)
if (isJson(path)) {
data = await response.json()
} else {
const res = await response.text()
const t = await new window.DOMParser().parseFromString(res, 'text/xml')
const a = await t
data = [...a.querySelectorAll('entry')].map(item =>{
return {
title: item.querySelector('title').textContent,
content: item.querySelector('content') && item.querySelector('content').textContent,
url: item.querySelector('url').textContent
}
})
}
if (response.ok) {
const $loadDataItem = document.getElementById('loading-database')
$loadDataItem.nextElementSibling.style.display = 'block'
$loadDataItem.remove()
}
return data
}

const search = () => {
if (!GLOBAL_CONFIG.localSearch.preload) {
dataObj = fetchData(GLOBAL_CONFIG.localSearch.path)
}

const $input = document.querySelector('#local-search-input input')
const $resultContent = document.getElementById('local-search-results')
const $loadingStatus = document.getElementById('loading-status')

$input.addEventListener('input', function () {
const keywords = this.value.trim().toLowerCase().split(/[\s]+/)
if (keywords[0] !== '') $loadingStatus.innerHTML = '<i class="fas fa-spinner fa-pulse"></i>'

$resultContent.innerHTML = ''
let str = '<div class="search-result-list">'
if (keywords.length <= 0) return
let count = 0
// perform local searching
dataObj.then(data => {
data.forEach(data => {
let isMatch = true
let dataTitle = data.title ? data.title.trim().toLowerCase() : ''
const dataContent = data.content ? data.content.trim().replace(/<[^>]+>/g, '').toLowerCase() : ''
const dataUrl = data.url.startsWith('/') ? data.url : GLOBAL_CONFIG.root + data.url
let indexTitle = -1
let indexContent = -1
let firstOccur = -1
// only match articles with not empty titles and contents
if (dataTitle !== '' || dataContent !== '') {
keywords.forEach((keyword, i) => {
indexTitle = dataTitle.indexOf(keyword)
indexContent = dataContent.indexOf(keyword)
if (indexTitle < 0 && indexContent < 0) {
isMatch = false
} else {
if (indexContent < 0) {
indexContent = 0
}
if (i === 0) {
firstOccur = indexContent
}
}
})
} else {
isMatch = false
}

// show search results
if (isMatch) {
if (firstOccur >= 0) {
// cut out 130 characters
// let start = firstOccur - 30 < 0 ? 0 : firstOccur - 30
// let end = firstOccur + 50 > dataContent.length ? dataContent.length : firstOccur + 50
let start = firstOccur - 30
let end = firstOccur + 100
let pre = ''
let post = ''

if (start < 0) {
start = 0
}

if (start === 0) {
end = 100
} else {
pre = '...'
}

if (end > dataContent.length) {
end = dataContent.length
} else {
post = '...'
}

let matchContent = dataContent.substring(start, end)

// highlight all keywords
keywords.forEach(keyword => {
const regS = new RegExp(keyword, 'gi')
matchContent = matchContent.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
dataTitle = dataTitle.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
})

str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>'
count += 1

if (dataContent !== '') {
str += '<p class="search-result">' + pre + matchContent + post + '</p>'
}
}
str += '</div>'
}
})
if (count === 0) {
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
'</div>'
}
str += '</div>'
$resultContent.innerHTML = str
if (keywords[0] !== '') $loadingStatus.innerHTML = ''
window.pjax && window.pjax.refresh($resultContent)
})
})
}

searchClickFn()
searchClickFnOnce()

// pjax
window.addEventListener('pjax:complete', () => {
!btf.isHidden($searchMask) && closeSearch()
searchClickFn()
})
})
Loading

0 comments on commit 8e1d6be

Please sign in to comment.