Skip to content

Instantly share code, notes, and snippets.

View pH-7's full-sized avatar
:octocat:
πŸ’‘Creative Engineer πŸš€ Enjoying Learning New Exciting Things! πŸ˜‹ =>My Way of Life 🏝

β™š PH⑦ β€” Pierre-Henryβ„’β™› pH-7

:octocat:
πŸ’‘Creative Engineer πŸš€ Enjoying Learning New Exciting Things! πŸ˜‹ =>My Way of Life 🏝
View GitHub Profile
@pH-7
pH-7 / ai-video.ts
Created July 1, 2024 12:15
Generate AI videos from a given image using Neon DB, Pinecone, and Replicate
import { Client } from 'pg';
import { PineconeClient } from '@pinecone-database/pinecone';
import Replicate from 'replicate';
// Initialize clients
const neonClient = new Client({
connectionString: 'your_neon_connection_string'
});
const pinecone = new PineconeClient();
@pH-7
pH-7 / keybindings.json
Last active August 22, 2024 07:30
Productivity Add Custom VS Code Keybindings. Move Cursor Up/Down by 2 Lines
[
{
"key": "alt+up",
"command": "cursorMove",
"when": "textInputFocus",
"args": {
"to": "up",
"by": "line",
"value": 2
}
@pH-7
pH-7 / get-medium-publication-ids.sh
Last active September 2, 2025 22:04
get-medium-publication-ids.sh
# First, set your Medium API token (from https://medium.com/me/settings/security if you do have one)
TOKEN="your-medium-token"
# 1. Get user ID
echo "Getting user ID..."
USER_INFO=$(curl -X GET "https://api.medium.com/v1/me" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Accept-Charset: utf-8")
@pH-7
pH-7 / LineBreak.tsx
Last active November 10, 2024 21:45
React Native Line Break component - Add easily line breaks in your React Native app
/**
* (c) 2024 Pierre-Henry Soria.
*/
import { StyleSheet, View, ViewStyle, DimensionValue } from 'react-native';
type LineBreakProps = {
width?: DimensionValue;
color?: string;
style?: ViewStyle;
};
@pH-7
pH-7 / .zprofile
Last active January 25, 2025 06:14
.zprofile useful aliases - (not maintained anymore) New updates are now happening in https://github.com/pH-7/dotfiles/
# Alias
alias vi="nvim"
alias c="clear"
alias push="git push origin head"
alias pull="git pull"
alias amend="git amend"
alias gi="git"
alias g="git"
alias gp="git push"
@pH-7
pH-7 / text_helpers.R
Last active July 18, 2025 13:43
R helper functions for strings
##
# Convert text to lowercase.
##
to_lowercase <- function(input_text) {
# Check if input is character
if (!is.character(input_text)) {
stop("Input must be a character string")
}
# Convert to lowercase
@pH-7
pH-7 / variables-constants-in-programming-context.md
Last active August 31, 2025 08:05
Learn how variables are declared in programming languages such as Python/R. (These are my notes that I use when mentoring someone who is learning the basics of programming and data science with Python) https://pierrehenry.substack.com | https://pH7.me

Variables/Constants in Programming Languages Context

In contrast to variables, constants do not change during the execution of a program and are usually declared in all capitals (uppercase), which is a common convention in programming.

@pH-7
pH-7 / create_icon.py
Created August 15, 2025 22:26
Create icons for pH7Console project - https://github.com/EfficientTools/pH7Console
#!/usr/bin/env python3
from PIL import Image, ImageDraw, ImageFont
import os
def create_terminal_icon(size=512):
# Create a new image with transparent background
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# Colors
@pH-7
pH-7 / useClickOutside.ts
Created August 16, 2025 06:50
React custom hook to handle click outside events for modals and dropdowns
import { useEffect, RefObject } from 'react';
/**
* Custom hook to handle click outside events for modals and dropdowns
* @param ref - Reference to the element to detect clicks outside of
* @param handler - Function to call when click outside is detected
* @param enabled - Whether the click outside detection is enabled (default: true)
*/
export const useClickOutside = (
ref: RefObject<HTMLElement>,
@pH-7
pH-7 / great-vscode-extensions.md
Last active August 27, 2025 12:06
Great VisualStudio Code Extensions & Themes