Skip to content

Instantly share code, notes, and snippets.

View somidad's full-sized avatar

Seokseong Jeon somidad

View GitHub Profile
@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.

@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"
}
@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() {
@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);
@somidad
somidad / workflow.yml
Last active January 15, 2025 08:43
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 / 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 / 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 / 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;
}