Skip to content

Instantly share code, notes, and snippets.

@Satal
Satal / dockerfile
Created February 18, 2024 11:18
Agency Swarm Dockerfile
# Use the latest Ubuntu image as the base
FROM ubuntu:latest
# Update apt package list and install python3 and pip3
RUN apt-get update && \
apt-get install -y python3 python3-pip git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
@Satal
Satal / .bashrc
Created January 21, 2024 16:50
A function that will make a directory and then change directory into it
# This goes at the end of .bashrc
mkcd() {
mkdir -p "$1" && cd "$1"
}
@Satal
Satal / update.sh
Created October 31, 2023 05:07
An update script for ubuntu
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt update -y && apt upgrade -y && apt dist-upgrade -y && apt autoclean -y && apt autoremove -y
# Install in C:\users\[user]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# You may need to run `Set-ExecutionPolicy RemoteSigned` if you get an error about running
function wingetlist {
# Based on the script provided at https://gist.github.com/alkampfergit/2f662c07df0ca379c8e8e65e588c687b
# Create a collection of strings for the ids of software that should be ignored
$ignoreList = @(
'Google.Chrome',
'JetBrains.PHPStorm'
@Satal
Satal / Ansible Winrm Variables
Created December 19, 2020 14:01
The variables that need to be set for Ansible to use Winrm
---
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
@Satal
Satal / Usage.cs
Last active March 6, 2017 15:23
XsdValidator
public void MultipleSchemas()
{
var validator = new XsdValidator();
validator.AddSchema(@"SchemaDoc1.xsd");
validator.AddSchema(@"SchemaDoc2.xsd");
var isValid = validator.IsValid(@"ValidXmlDoc1.xml");
}
@Satal
Satal / ShuffleStringExcludeOriginal
Last active December 22, 2015 08:39
Shuffle the characters in a string but excluding the original string that was passed in. The method checks that we have passed in a string of more than two characters as if we have less than two characters it is not possible to return anything but the original string.
public static string ShuffleStringExcludeOriginal(string stringToShuffle)
{
    string shuffled;
 
    if (String.IsNullOrEmpty(stringToShuffle))
    {
        throw new ArgumentNullException("stringToShuffle",
                                        "The stringToShuffle variable must not be null or empty");
    }