This file contains 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
alias gh="open \`git remote -v | grep [email protected] | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`" |
This file contains 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
const axios = require('axios') | |
const { URLSearchParams } = require('url') | |
const getFullBlockId = (blockId) => { | |
if (typeof blockId !== 'string') { | |
throw Error(`blockId: ${typeof blockId} must be string`) | |
} | |
if (blockId.match("^[a-zA-Z0-9]+$")) { | |
return blockId.substr(0, 8) + "-" | |
+ blockId.substr(8, 4) + "-" |
This file contains 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 React, {Component, createContext} from 'react'; | |
import {setName} from "./actions"; | |
const Context = createContext(); | |
export class Provider extends Component { | |
genActions = () => { | |
let actions = {}; |
This file contains 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 allSongsDiv = document.querySelectorAll('div.song > div.tt > div > span'); | |
let songList = []; | |
allSongsDiv.forEach(item=>songList.push(item.innerText)); | |
let clearSongList = songList.map(item=>{ | |
let [name,artist] = item.split(" -"); | |
return `${name} - ${artist}` | |
}) | |
let text = clearSongList.join('\n'); | |
text |
This file contains 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 django.db import models | |
class CommonModel(models.Model): | |
create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True, blank=True) | |
update_time = models.DateTimeField(verbose_name='更新时间', auto_now=True, blank=True) | |
active = models.NullBooleanField(verbose_name='是否有效', default=True, blank=True) | |
class Meta: | |
abstract = True |
This file contains 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
onEmailChange = (e) => { | |
e.persist(); | |
this.setState({ | |
email: e.target.value | |
}, () => { | |
this.checkEmail(e.target.value) | |
}) | |
}; | |
checkEmail = (email) => { |
This file contains 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 hashlib as hash | |
# Specify how many bytes of the file you want to open at a time | |
BLOCKSIZE = 65536 | |
sha = hash.sha256() | |
with open('kali.iso', 'rb') as kali_file: | |
file_buffer = kali_file.read(BLOCKSIZE) | |
while len(file_buffer) > 0: | |
sha.update(file_buffer) |
NewerOlder