Skip to content

Instantly share code, notes, and snippets.

View somidad's full-sized avatar

Seokseong Jeon somidad

  • Samsung Electronics
  • Korea, Republic Of
View GitHub Profile
@somidad
somidad / obsidian-code-block-scroll.css
Last active March 21, 2024 23:30
Stop Obsidian wrapping code and enable scrolling
/* same article on [dev.to](https://dev.to/somidad/stop-obsidian-wrapping-code-and-enable-scrolling-47oo) */
/* it only works on Reading view */
/* https://forum.obsidian.md/t/horizontal-scrolling-in-the-code-block/55789/2 */
.markdown-rendered code {
white-space: pre;
}
@somidad
somidad / README.md
Last active March 21, 2024 13:13
Enable a link to a block in a note using Obsidian GitHub Publisher

Same article on dev.to

TL;DR

Here's my configuraiton (in data.json):

    "censorText": [
      {
 "entry": "/ (\\^\\w+)$/gm",
@somidad
somidad / logseq-publish-github-pages-wa.js
Last active June 25, 2022 07:54
Script to remove U+2029 from published Logseq graph for GitHub Pages
const { readFileSync, writeFileSync } = require("fs");
function indexOfUnicode(s, u) {
let i = -1;
for (i = 0; i < s.length; i++) {
if (s.charCodeAt(i) === u) {
break;
}
}
return i;
@somidad
somidad / workflow.yml
Last active June 23, 2023 14:06
GitHub Workflow to check any change on git repository and do something if any
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
- name: Check if there is any change
id: get_changes
# deprecated. see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
#run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
- name: Do something if there is any change
if: steps.get_changes.outputs.changed != 0
run: do something
@somidad
somidad / decode_jwt.js
Created April 10, 2022 02:42
Decode JWT (without verification)
const [header, payload, signature] = jwt.split('.');
const buffer = Buffer.from(payload, 'base64');
const decoded = JSON.parse(buffer);
@lvngd
lvngd / rectCollide.js
Created February 3, 2021 19:20
Rectangular collision detection in D3 force layouts. Blog post: https://lvngd.com/blog/rectangular-collision-detection-d3-force-layouts
function rectCollide() {
var nodes,sizes,masses;
var strength = 1;
var iterations = 1;
var nodeCenterX;
var nodeMass;
var nodeCenterY;
function force() {
@CMCDragonkai
CMCDragonkai / ssh_key_conversions.sh
Last active January 15, 2018 19:25
SSH: Conversions between OpenSSH Keys (Public/Private) and Putty Keys (PPK)
# it turns out that puttygen can do almost all conversions anyway
: '
ssh-private-public - Convert an openssh private key to an openssh public key
Usage: ssh-private-public <path-to-key> <path-to-key.pub>
'
ssh-private-public () {
ssh-keygen -f "$1" -y >"$2"
}
@commonquail
commonquail / convert-doc-to-docx.md
Last active October 4, 2023 12:40
Recursively convert .doc to .docx

Microsoft Office 2007 and 2010 include a tool that can convert .doc-files to .docx-files from the command line.

This will not get rid of the compatibility-mode message -- that requires opening the file and saving it as a new format -- but it does help with reducing file sizes and cross-platform compatibilities.

The tool is called Wordconv.exe and is located in the root Office folder, e.g. Office14.

@gaoyifan
gaoyifan / RTAI installation for ubuntu 14.04.md
Last active March 17, 2019 10:31
RTAI installation for ubuntu 14.04

RTAI installation for ubuntu 14.04

Preparation

download and unzip

cd /usr/src
curl -L https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.1.tar.bz2 | tar xj
curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.32.tar.xz | tar xJ
curl -L http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.10.32-saucy/linux-image-3.10.32-031032-generic_3.10.32-031032.201402221635_amd64.deb -o linux-image-3.10.32-generic-amd64.deb
@roundand
roundand / OpenWithSublimeText3.bat
Last active June 29, 2024 01:16 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f