Skip to content

Instantly share code, notes, and snippets.

View Joilence's full-sized avatar

jyang Joilence

  • Germany
View GitHub Profile
@Joilence
Joilence / roam-obsidian-date-convert.py
Last active January 31, 2024 19:00 — forked from jenningsb2/roam-obsidian-date-convert.py
Convert date format in file names and contents from Roam Research default style to Obsidian default style.
import re
import os
from dateutil.parser import parse
path = '' #insert file path to your vault here
### Convert date format in file content
for root, dirs, files in os.walk(path):
files = [f for f in files if re.match(r'.*\.md', f)] # only keep files end with `.md`
@Joilence
Joilence / Github-style-syntax-in-pages.md
Last active November 12, 2020 10:01 — forked from sudara/Github-style-syntax-in-pages.md
Github Style Code Syntax Highlighting in Pages.app

Based on this post on stack exchange.

install

# install Pygments
sudo easy_install Pygments # or brew install pygments

# install gihub style syntax
git clone git://github.com/hugomaiavieira/pygments-style-github.git
cd pygments-style-github
@Joilence
Joilence / README.md
Created October 3, 2020 06:26 — forked from jlongtine/README.md
youtube-timestamp.ts

You can add this to Roam using {{[[roam/js]]}}

Grab the code in youtube-timestamps.js and drop it in a javascript code block:

  ```javascript```

You can have timestamps at the beginning of any nested block. H:MM:SS

You can use the ctrl+shift+y hotkey (currently assumes you have Roam42 installed, let me know if you'd prefer I drop that requirement) to grab the current timestamp of the video you're cursor is nested under and add it to the beginning of your block.

@Joilence
Joilence / matrix.tex
Last active June 15, 2020 13:00
Pages LaTeX
\begin{bmatrix}
0.5 & 1 & 0 \\
1 & 0 & 0.5 \\
0 & 0.5 & 0.5 \\
\end{bmatrix}
@Joilence
Joilence / math.js
Created January 22, 2020 10:07
Math #js
k = b && a / b
// equal to
if (b === 0) {
k = 0;
} else {
k = a / b
}
@Joilence
Joilence / d3.js
Last active January 21, 2020 20:07
D3.js: Data Manipulation #d3
d3.csv(path).then((data) => {
// get columns name
data.columns
// get columns name except for some columns
columns = data.columns.filter(d => d !== 'class' && d !== 'id' && d !== '');
// select certain one column as array
key_data = data.map(d => (d[key]));
@Joilence
Joilence / save_safari_tabs.scpt
Created July 5, 2019 10:08 — forked from tshu-w/save_safari_tabs.scpt
Save all safari tabs in a single file and reopen them with a single click.
-- Detect if the Safari window exists
tell application "System Events"
if not (exists (front window of process "Safari")) then
return
end if
end tell
-- Assume the frontmost Finder window (or the Desktop)
-- is where we want to store the script.
try
@Joilence
Joilence / wifi-toggle.scpt
Last active January 9, 2020 08:55
Toggle WiFi on macOS
set status to do shell script "networksetup -getairportpower en0"
if status ends with "On" then
do shell script "networksetup -setairportpower en1 off"
else
do shell script "networksetup -setairportpower en1 on"
end if