Skip to content

Instantly share code, notes, and snippets.

View petergi's full-sized avatar
💭
Just Busy Living On The Side Of A Square

Peter Giannopoulos petergi

💭
Just Busy Living On The Side Of A Square
View GitHub Profile

This is the simplest "hello world" example.

This example was generated with:

$ bashly init --minimal
$ bashly generate

In (N)Vim, you can perform search and replace operations using the :substitute command. Here are the basic steps and syntax for doing search and replace:

Basic Syntax

The basic command for search and replace in (N)Vim is:

:s/pattern/replacement/
@petergi
petergi / Kill the process running on a specific port.sh
Created June 26, 2025 15:18
Kill whichever process is running on the given port
# Kill the process running on a port
lsof -t -t:port 1 xargs kill
@petergi
petergi / Export your notes to Markdown from OneNote on Mac.sh
Last active June 26, 2025 15:15
This command will convert each .docx file in the directory to a Markdown file with ATX-style headers. If you prefer Setext-style headers, you can replace atx with setext.
# 1 - Export to Word Document: First, export your OneNote pages to a .docx (Word) format using the OneNote export feature from the File menu.
# 2 - Install Pandoc: Install Pandoc on your Mac (https://gist.github.com/petergi/dcfe4279bb9c586463d0c4936a0738df#file-install-pandoc-on-macos-sh).
# 3 - Convert to Markdown: Use the terminal to navigate to the directory where your .docx files are saved.
# Run the following command to convert the .docx files to Markdown:
for file in *.docx; do
pandoc -f docx -t markdown_strict -i "$file" -o "${file%.docx}.md" --wrap=none --markdown-headings=atx
done
@petergi
petergi / Install Pandoc on macOS.sh
Created June 26, 2025 15:11
You can use Conda, Ports, Homebrew or the Installer Package directly (https://pandoc.org/installing.html) But seriously do yourself a favor just use Homebrew! Using Homebrew: Homebrew is a popular package manager for macOS that simplifies the installation process. If you don't have Homebrew installed, you can install it by running the following …
# If you don't already have it.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Once Homebrew is installed, you can install Pandoc by running:
brew install pandoc
@petergi
petergi / lsof examples.sh
Created May 7, 2025 14:25
You know.. a couple of handy examples of how to use lsof...
# Find what's using a volume on macOS
lsof | grep /Volumes/
# Check what processes are listening on port
lsof -iTCP -sTCP:LISTEN -P -n
# Kills a process using PID
#
# awk grabs the PIDs.
# tail gets rid of the pesky first entry: "PID".
Create a meeting agenda with the goal of discussing the progress of {{Project_Name}} based on {{Project_Document}}. This meeting is part of our regular {{meeting_frequency (weekly/bi-weekly/monthly)}} check-ins to ensure all team members are aligned and the project is on track, involving the development of
1. {{Project_task}}
2. {{Project_task}}
3. {{Project_task}}
The purpose of the meeting is to have a clear understanding of the current project status, any issues that need to be addressed, and the next steps for each team member. Outline expectations by asking all team members to come prepared with updates on their tasks, any challenges they are facing, and suggestions for improvement, encouraging active participation and open communication for a productive discussion.
@petergi
petergi / Prompt - Act As A Statistician
Last active April 2, 2025 20:45
Example User Input: I need help calculating how many million banknotes are in active use in the world
I want you to act as a Statistician. I will provide you with details related with statistics.
You should be knowledgeable of statistics terminology, statistical distributions, confidence interval, probability, hypothesis testing and statistical charts.
docker run --platform linux/amd64 --hostname=sqlpreview --user=root --env=ACCEPT_EULA=Y --env=MSSQL_SA_PASSWORD='yourStrong(!)Password' --env=MSSQL_PID=Evaluation --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=MSSQL_RPC_PORT=135 --env=CONFIG_EDGE_BUILD= --network=bridge -p 1433:1433 --restart=no --label='com.microsoft.product=Microsoft SQL Server' --label='com.microsoft.version=16.0.4085.2' --label='org.opencontainers.image.ref.name=ubuntu' --label='org.opencontainers.image.version=22.04' --label='vendor=Microsoft' --runtime=runc --mount source=ChannelManagerData,target=/ChannelManager_Data -d mcr.microsoft.com/mssql/server:2022-latest
@petergi
petergi / GitHub Gist Downloader.py
Created October 28, 2024 13:26
Downloads and manages GitHub gists using the GitHub API.
import requests
import os
def create_directory(dirname):
#Creates a new directory if a directory with dirname does not exist
try:
os.stat(dirname)
except:
os.mkdir(dirname)