Skip to content

Instantly share code, notes, and snippets.

View DavideDunne's full-sized avatar
💾

Davide Dunne Sanchez DavideDunne

💾
View GitHub Profile
@DavideDunne
DavideDunne / main.tf
Created May 26, 2024 00:21
Terraform for creating an OCI VCN with a subnet and an internet gateway
# https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_vcn
resource "oci_core_vcn" "test_vcn" {
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# cidr block: Collection of IP's
# Will be assigning 255 addresses
cidr_block = "192.168.1.0/24"
display_name = "tec vcn"
dns_label = "tecvcn"
}
@DavideDunne
DavideDunne / note.org
Created May 19, 2024 04:43
code preview in emacs org-mode

my second test

To get started with org-mode Link

Things to learn

Tests

Python

  • This is code block for Latex
        
@DavideDunne
DavideDunne / init.el
Created May 14, 2024 19:13
Basic emacs config, by Uncle Dave
;; This is the basic emacs config, as seen in the video by Uncle Dave https://youtu.be/8Zkte37UOnA?si=R2B3iHLMgFb9-zwL
;; Remove the tool bar (file, edit, etc) and menu bar (the bar with icons)
;; init.el, should be in ~/.emacs.d/init.el
;; in windows it should be in C:\Users\user\AppData\Roaming\.emacs.d
(tool-bar-mode -1)
(menu-bar-mode -1)
@DavideDunne
DavideDunne / project.sql
Created April 1, 2024 05:03
T-SQL tests
USE [test];
GO
IF OBJECT_ID (N'dbo.Enrollments', N'U') IS NOT NULL
DROP TABLE [dbo].[Enrollments]
GO
IF OBJECT_ID (N'dbo.Students', N'U') IS NOT NULL
DROP TABLE [dbo].[Students]
GO
IF OBJECT_ID (N'dbo.Courses', N'U') IS NOT NULL
@DavideDunne
DavideDunne / MakeAllAppImageExecutable.sh
Created March 31, 2024 20:25
Make all AppImages in the user home directory executable
#!/bin/bash
echo "Make all the appimages in user directory executable"
find ~ -type f -iname "*.AppImage" -exec chmod u+x {} \;
@DavideDunne
DavideDunne / CreateShortcutSMBFolder.ps1
Last active March 26, 2024 03:12
Get all the folders that are being shared by the SMB on the current machine and make a shortcut for each of all of those inside a given folder
param(
# Folder path where the shortcuts will be created
[Parameter(Mandatory=$true)]
[string]$Folder
)
# Test if folder is a valid path of a folder
if (-not (Test-Path $Folder -PathType Container)) {
Write-Host "Folder path is not valid"
exit
@DavideDunne
DavideDunne / Program.cs
Created March 7, 2024 18:39
Interview template for C#
#region headers
global using static System.Console;
//Implicit using List:
// using System
// using System.Collections.Generic
// using System.IO
// using System.Linq
// using System.Net.Http
// using System.Threading
// using System.Threading.Task
@DavideDunne
DavideDunne / ExportCsvButton.razor
Created February 25, 2024 17:57
Blazor component for exporting a list of objects to a csv
@using System.IO
@using CsvHelper
@using System.Globalization
@inject IJSRuntime JS
@code {
/// <summary>
/// Export to CSV from a Collection by clicking a button
/// Code obtained from: https://learn.microsoft.com/en-us/aspnet/core/blazor/file-downloads?view=aspnetcore-6.0#download-from-a-stream
/// https://joshclose.github.io/CsvHelper/getting-started/#writing-a-csv-file
/// </summary>
@DavideDunne
DavideDunne / Program.cs
Created August 17, 2023 04:38
Run powershell commands from C#
using System.Management.Automation; // https://www.nuget.org/packages/System.Management.Automation/
using Microsoft.PowerShell; // https://www.nuget.org/packages/Microsoft.PowerShell.SDK/
namespace PowershellCSGist
{
internal class Program
{
static void Main()
{
PowerShell ps = PowerShell.Create();
@DavideDunne
DavideDunne / zipeverything.ps1
Last active August 16, 2023 17:12
Zip everything in current dir
#This script will copy all the files in current directory into a zip
$Files = Get-ChildItem -Exclude *.ps1 -Name
Write-Host $Files
foreach($File in $Files){
Compress-Archive -Path $File -Update -DestinationPath files.zip
}