Skip to content

Instantly share code, notes, and snippets.

@da-moon
da-moon / pandocdocx2md.md
Created October 18, 2024 11:16 — forked from plembo/pandocdocx2md.md
Convert docx to markdown with pandoc

Convert Word documents to markdown with pandoc

I use pandoc to convert masses of Word documents to markdown. Still working on a generic script, but for now here's the "gist" of what I type into the terminal:

$ myfilename="example"
$ pandoc \
-t markdown_strict \
--extract-media='./attachments/$myfilename' \
$myfilename.docx \
@da-moon
da-moon / Setup-WSL2SSH.ps1
Last active September 6, 2024 02:12
Powershell script to setup SSH server in WSL so that Windows users can SSH into WSL. It can be useful for "remote" development with Editors such as Lapce or Zed
# Flexible WSL2 SSH Setup Script with Distribution Detection
# Ensure running as Administrator
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Please run this script as Administrator!"
Exit
}
# Function to get the default WSL distribution
function Get-DefaultWSLDistribution {
@da-moon
da-moon / build-zed.ps1
Last active October 8, 2024 00:59
Powershell script to build and setup latest version of zed on windows
# Zed Build and Update Script for Windows
# This script builds or updates Zed from source and sets up a command-line interface.
# Enable strict mode
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Configuration
$ZedRepo = "https://github.com/zed-industries/zed.git"
$BuildDir = "$env:USERPROFILE\zed-build"
@da-moon
da-moon / README.md
Created July 13, 2024 16:06 — forked from MichaelCurrin/README.md
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

@da-moon
da-moon / 00.howto_install_phantomjs.md
Created July 8, 2024 21:44 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@da-moon
da-moon / readme.txt
Created July 4, 2024 00:59 — forked from ANRCorleone/readme.txt
Ubuntu 22.04 + Hyper V + Enhanced Session mode + XRDP PulseAudio
Credits
# https://c-nergy.be/blog/?p=13655
# https://askubuntu.com/questions/844245/how-to-compile-latest-pulseaudio-with-webrtc-in-ubuntu-16-04
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
# https://unix.stackexchange.com/questions/65167/enable-udev-and-speex-support-for-pulseaudio
# https://rudd-o.com/linux-and-free-software/how-to-make-pulseaudio-run-once-at-boot-for-all-your-users
# https://gist.github.com/rkttu/35ecab5604c9ddc356b0af4644d5a226
# Installation and Enhanced session
# follow steps on the post below, I installed Ubuntu 22.04 on a Windows 11 machine
git log --pretty=format:"@%ad ~~%s~~" --date=short --shortstat \
| tr "\n" " " \
| tr "@" "\n" \
| grep -v 'skip ci' \
| grep -v 'deps' \
| grep -v 'dependencies' \
| sed -En 's/ ~~.*~~ /,/p'

After long searching I did not find a good description of how to set up Syncthing that works exclusively via CLI without using a Web browser on the devices.

This is useful for example on a headless Raspberry Pi without proxying web-traffic through SSH or with port-forwarding limitations. In this example we will want to share the default folder from Machine A with Machine B

Machine A Machine B