Skip to content

Instantly share code, notes, and snippets.

View smnatale's full-sized avatar

Sam smnatale

  • United Kingdom
  • 06:07 (UTC +01:00)
View GitHub Profile
-- Copy file path / selection reference for pasting into AI chats
local function copy_ref(opts)
-- "%" is the current buffer's file name; ":." makes it relative to the cwd
local path = vim.fn.expand("%:.")
-- ref is what ends up in the clipboard; start with just the path
local ref = path
if opts.visual then
-- '< and '> are only set after leaving visual mode, so read the live selection:
-- "v" is the line where visual mode was started (the anchor)
@smnatale
smnatale / keybindings.json
Created July 1, 2026 21:06
vscode vim setup
// Place your key bindings in this file to override the defaults
[
// terminal toggle
{
"key": "f12",
"command": "workbench.action.terminal.toggleTerminal",
},
// terminal navigation
{
"key": "ctrl+1",
-- highlight yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("highlight_yank", { clear = true }),
pattern = "*",
desc = "highlight selection on yank",
callback = function()
vim.highlight.on_yank({ timeout = 200, visual = true })
end,
})
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
{ src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" },
vim.pack.add {
{ src = 'https://github.com/neovim/nvim-lspconfig' },
{ src = 'https://github.com/mason-org/mason.nvim' },
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
{ src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' },
}
require('mason').setup()
require('mason-lspconfig').setup()
require('mason-tool-installer').setup({
@smnatale
smnatale / ai-skin-assignment.ipynb
Created April 17, 2023 22:29
AI Skin Assignment.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smnatale
smnatale / Magic8.java
Created June 4, 2020 23:03
Codecademy Challenge - Magic 8 Ball 'Game'
import java.util.Random;
import java.util.ArrayList;
import java.util.Arrays;
public class Magic8{
// Magic 8 Ball usually has a 20 sided dice inside with 10 positive dice sides, 5 negative dice sides and 5 vague responses
// Below defines positive/negative/vague responses
ArrayList<String> positiveResponses = new ArrayList<String> (Arrays.asList("As I see it yes", "It is certain", "It is decidedly so", "Most likely", "Outlook good", "Signs point to yes", "Without a doubt", "You may rely on it", "Yes definitely", "Absolutely"));
@smnatale
smnatale / DNA.java
Created June 4, 2020 22:03
Codecademy Challenge - Program checks if a DNA strand contains a protein
// Program is designed to check if a DNA Sequence is a protein, it does this by checking if it contains ATG, contains TGA at some point after ATG and the characters inbetween are divisible by 3
public class DNA{
public boolean isProtein(String dna){
// The begins and ends variables find the index value of where ATG starts and the index value of where TGA starts + 3 so we get the value of where it ends
int begins = dna.indexOf("ATG");
int ends = (dna.indexOf("TGA")) + 3;
// The string newDna now will hold the new string starting with ATG and ending with TGA cutting out anything before or after in the original string
@smnatale
smnatale / PrimeDirective.java
Last active June 4, 2020 22:04
Codecademy Challenge - Program checks if any of the numbers in an Array are Prime Numbers
import java.util.ArrayList;
class PrimeDirective {
/* This checks if the number is prime by first checking if the number is 0 or less than 0, which makes it not prime.
It then checks if the number is divisible by every number from 3 to itself -1, if it is divisible it sets the return as false as it cannot be a prime number, it it is not the value remains as true */
public boolean isPrime(int num){
boolean value = true;