Skip to content

Instantly share code, notes, and snippets.

View joe-oli's full-sized avatar
💭
what the flock? no status to report, i am not a facebook junkie.

joe-oli

💭
what the flock? no status to report, i am not a facebook junkie.
View GitHub Profile
@joe-oli
joe-oli / git-set-upstream.md
Created April 17, 2025 17:52
Git set upstream on a new branch

The -u in git push -u origin main is a shorthand option for --set-upstream.

When you use git push -u origin main for the first time for a local branch, it does two things:

  1. Pushes your local main branch to the remote repository named origin. If a main branch doesn't exist on the remote yet, Git will create it.
  2. Sets up a tracking connection (upstream) between your local main branch and the remote origin/main branch. This means that Git now remembers that your local main branch is associated with the main branch on the origin remote.

Why is this tracking connection useful?

Once the upstream is set, you can use simpler Git commands in the future:

@joe-oli
joe-oli / Program.cs
Created April 17, 2025 17:04
dotnet Program.cs example (no Startup.cs required)
using Blog.EFLayer.Models;
using Microsoft.EntityFrameworkCore;
using Jolisoft.Common.Logging; //AddFileLogger
namespace Blog.Api;
public class Program
{
public static void Main(string[] args)
ui/
├── public/
│ └── index.html
├── src/
│ ├── index.tsx
│ ├── App.tsx
│ ├── router.tsx
│ ├── assets/
@joe-oli
joe-oli / Program_Startup.cs
Last active April 2, 2025 00:23
dotnet new webapi -n MyWebApiProj --use-program-main and --use-controllers
//Older style, with Startup.cs; BEFORE .NET 6.x;
// Program.cs (Typical .NET Core 3.1)
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace MyWebApp
{
public class Program
{
@joe-oli
joe-oli / ProjectMauiApp.xml
Created March 24, 2025 04:00
Sample Project file ProjName.csproj for .NET MAUI
<!--
The template in VS ".NET MAUI App" creates by default other platforms e.g. maui-android, maui-ios, maui-catalyst, maui-tizen, etc;
It's just not worth it, as it does NOT build by default; At least not when I tried it!
Better remove all the other platforms if you only want Windows; Below is the modified project file to target only Windows;
Delete the other folders under "Platforms"
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows10.0.19041.0</TargetFrameworks>
@joe-oli
joe-oli / descale-downgrade-video-res.md
Created March 23, 2025 03:05
video resolutions, ffmpeg notes
# Version 1: Full WxH specification
ffmpeg -i input.mp4 -vf scale=640:360 output_640x360.mp4

# Version 2: Width only, adjust height automatically
ffmpeg -i input.mp4 -vf scale=640:-1 output_640xauto.mp4

# Version 3: Height only, adjust width automatically
ffmpeg -i input.mp4 -vf scale=-1:360 output_auto_x360.mp4
@joe-oli
joe-oli / ai-prompt.md
Last active February 16, 2025 10:31
Songs - Stevie - Lately

Q. Finally! After many retries, you finally get it; Next time I want to ask you to output in a similar way, so that it goes across lines, what language should I use, so you can grasp the concept?

A. You can ask me to format the text in markdown, and you can mention that you'd like it in code blocks to ensure it's structured clearly across lines.

You can say something like, "Can you format this using markdown in code blocks?" This helps me understand that you want the text structured neatly, like I did earlier.

Here's an example of how you could phrase it:

@joe-oli
joe-oli / Artificial-intelligence.md
Last active February 9, 2025 04:15
Artificial intelligence URL's
# Node.js dependencies
/node_modules/
/ui/node_modules/
/ui/client/node_modules/
# Build outputs
/dist/
/ui/client/build/
/ui/client/.next/
/out/
@joe-oli
joe-oli / rename.bat
Created October 27, 2024 01:01
Batch file to rename folders This.Is.My.Folder.(2024) Will be renamed "This Is My Folder (2024)" i.e. remove the dots
@echo off
setlocal enabledelayedexpansion
for /d %%F in (*.*) do (
set "folder=%%F"
set "newfolder=!folder:.= !"
ren "%%F" "!newfolder!"
)