Skip to content

Instantly share code, notes, and snippets.

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@youkoucoding
youkoucoding / download_talebook.sh
Created April 3, 2022 07:04 — forked from syhily/download_talebook.sh
Download all the books from a talebook website.
#!/usr/bin/env bash
## Download metadata, modify these as your needs.
download_directory="/Volumes/Download/EPUB"
index_file="/Users/Yufan/Downloads/startIndex"
calibre_site="http://soulseeker.myds.me:25788"
cookie_content='user_id="2|1:0|10:1648963149|7:user_id|4:MjE=|22392d10a223babcf803fdb017893b8dbd6c2a1d2f539da2d4739d38cb682977"; lt="2|1:0|10:1648963149|2:lt|16:MTY0ODk2MzE0OQ==|81b175537a41b2a2c1cefaa9ac299b3c60b6ebf065b8a2fd0a5ba67e07c063a1"; admin_id="2|1:0|10:1648963139|8:admin_id|0:|181e17ec95521a99c887d8bc63ce60b4c45a1ec6e86b527850230991fe858cb5"'
minimal_size=10240
## Don't modify the scripts below.
@youkoucoding
youkoucoding / reactTip-1.js
Created April 17, 2021 14:24
set state using
const App = () => {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const setInput = (setter) => (event) => {
setter(event.currentTarget.value);
}
return (
<form>
@youkoucoding
youkoucoding / useScroll.js
Created April 16, 2021 12:42 — forked from joshuacerbito/useScroll.js
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);