This file contains hidden or 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
| # Original: https://serverfault.com/questions/341919/how-to-find-error-messages-from-linux-init-d-rc-d-scripts | |
| # Reference: http://urbanautomaton.com/blog/2014/09/09/redirecting-bash-script-output-to-syslog/ | |
| exec 1> >(logger -s -t $(basename $0)) 2>&1 |
This file contains hidden or 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 | |
| stats=”” | |
| echo "% user" | |
| echo "============" | |
| # collect the data | |
| for user in `ps aux | grep -v COMMAND | awk '{print $1}' | sort -u` | |
| do | |
| stats="$stats\n`ps aux | egrep ^$user | awk 'BEGIN{total=0}; \ |
This file contains hidden or 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
| $OldBase="C:\src\main\java" | |
| $NewBase="C:\src\main\resources" | |
| $HibernateFiles=Get-ChildItem $OldBase -Include *.xml -Recurse | |
| foreach ($file in $HibernateFiles) { | |
| Write-Host $file.FullName | |
| $Directory=$file.Directory.ToString() | |
| $Directory=$Directory.replace($OldBase, $NewBase) | |
| $OldFile=$file.FullName | |
| $NewFile=$OldFile.replace($OldBase, $NewBase) | |
| New-Item $Directory -ItemType Directory -ea 0 |
This file contains hidden or 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
| :: simple version | |
| $env:path.Split(';') | gci -Filter application.exe | |
| :: expanded version | |
| $env:path.Split(';') | select -Unique | ? {$_ -and (test-path $_)} | gci -Filter application.exe |
This file contains hidden or 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
| import boto3 | |
| from boto3 import ec2 | |
| import datetime | |
| import re | |
| from datetime import date | |
| def is_attached(image, snapshot): | |
| for mapping in image['BlockDeviceMappings']: | |
| # Is it a machine ephemeral device? |
This file contains hidden or 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
| DT = data.table(A=c("Peter Parker", "Bruce Wayne", "Barry Allen", "Diana", "Clark Kent"), | |
| B=c("Spiderman", "Batman", "Flash", "Wonderwoman", "Superman"), | |
| C=c("Dr. Octopus", "Joker", "Magenta", "Baroness Paula von Gunther", "Lex Luthor")) | |
| d1 <- copy(DT) | |
| d2 <- copy(DT) | |
| d3 <- copy(DT) | |
| setorder(d1, A) |
This file contains hidden or 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 DEFINER=`valtoni`@`%` PROCEDURE `get_memory`() | |
| BEGIN | |
| DECLARE var VARCHAR(64); | |
| DECLARE val VARCHAR(1024); | |
| DECLARE done INT; | |
| #Variables for storing calculations | |
| DECLARE GLOBAL_SUM DOUBLE; | |
| DECLARE PER_THREAD_SUM DOUBLE; |
This file contains hidden or 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 | |
| if [ $(dpkg-query -W -f='${Status}' socat 2>/dev/null | grep -c "ok installed") -eq 0 ]; then | |
| apt-get install socat; | |
| else | |
| echo "*** Package socat already installed" | |
| fi | |
| MAPPINGS=("1231,10.0.12.1,123" "1232,10.0.12.2,123") |
This file contains hidden or 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
| find . -name 'message-*.csv' -exec wc -l {} \; | awk -F'[[:space:]-]' ' | |
| NR == 1 { print; next } | |
| { | |
| id = $3; | |
| qty = $1; | |
| if (qty < 289) { | |
| reads[id] = qty; | |
| } | |
| } END { | |
| for (r in reads) { |
This file contains hidden or 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
| Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
| $packages = "powershell-core oh-my-posh vscode python3 office365business obsidian cloudflared gitkraken intellijidea-ultimate git.install docker-cli chromium discord.install advanced-ip-scanner expressvpn keepass audacity notepadplusplus.install staruml 7zip adobereader cpu-z.install crystaldiskmark zoom microsoft-windows-terminal icloud heidisql gnupg gpg4win rustdesk nodejs rdm winscp putty.install golang kubernetes-helm kustomize vlc" | |
| foreach ($package in ($packages.split(" "))) { | |
| choco install $package -Y | |
| } | |
| go install github.com/sigstore/cosign/v2/cmd/cosign@latest |