Skip to content

Instantly share code, notes, and snippets.

View axi92's full-sized avatar

axi92 axi92

  • Vienna
View GitHub Profile
@axi92
axi92 / generate.sh
Created March 19, 2024 14:04
Clone all bitbucket repos from all projects
#!/bin/bash
# generate a script ./clone-repos.sh from a list of repos fetched via Bitbucket API
# note: requires 'curl' and 'jq' to be installed
set -e
ONPREM_USER=""
ONPREM_PASS=""
URL=""
@axi92
axi92 / binary_check.bash
Created June 29, 2023 08:21
Check git for not allowed binaries
#!/bin/bash
# set -e
ERRORS=$(grep -rIL --exclude-dir=.git --exclude=*.png --exclude=*.jpg --exclude=*.crt --exclude=*.ttf . | wc -l)
if [ $ERRORS -gt "0" ]; then
echo '########################################'
echo 'Not allowed binaries are found in repo!'
echo 'Remove them:'
echo ''
@axi92
axi92 / green.xml
Created April 13, 2023 12:33
Junit xml red/green example
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite name="NPM Audit Advisories">
<testcase name="MODERATE: 1091459 - Server-Side Request Forgery in Request">
</testcase>
<testcase name="HIGH: 1091653 - xml2js is vulnerable to prototype pollution ">
</testcase>
</testsuite>
</testsuites>
@axi92
axi92 / pre-commit
Last active May 18, 2022 14:43
pre-commit git hook prevent binaries from commiting
#!/bin/sh
staginlist=(`git diff --name-only --cached`)
binarylist=()
for filelist in ${staginlist[*]}
do
grep -Iq . ${filelist}
if [ $? -ne 0 ]
then
@axi92
axi92 / sample-server.js
Created October 7, 2021 06:35
Opcua server never exits
/*global require,setInterval,console */
const opcua = require("node-opcua");
// Let's create an instance of OPCUAServer
const server = new opcua.OPCUAServer({
port: 4334, // the port of the listening socket of the server
resourcePath: "/UA/MyLittleServer", // this path will be added to the endpoint resource name
buildInfo: {
productName: "MySampleServer1",
buildNumber: "7658",
@axi92
axi92 / report-ip-to-telegram-bot.sh
Created January 18, 2021 12:30
Send hostname and ip from device via telegram bot to channel or user
#!/bin/bash
TEXT="Hostname: $(hostname) - IP: $(hostname -I | awk '{print $1}')"
CHATID=""
TOKEN=""
curl -s -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "'"${CHATID}"'", "text": "'"${TEXT}"'", "disable_notification": false}' \
https://api.telegram.org/bot${TOKEN}/sendMessage
@axi92
axi92 / gist:b75502aad942d1c775867e111f3f7930
Created July 9, 2020 10:42
Chroot into raspi sd card
sudo proot -q qemu-arm -S /media/user/rootfs # <-mount path
@axi92
axi92 / nexus3-uploader.sh
Created January 21, 2020 09:23
This script uploads a folder with all its files into a sonatype nexus3 repository.
#!/bin/bash
# # ./nexus3-uploader.sh username password repo folder
url="http://domain.com:8081/nexus/repository/$repository/"
if [ $# -eq 0 ]; then
# Read Nexus3 Repository
echo -n "Nexus3 repository: "
read repository
# Read folder to upload
@axi92
axi92 / config.js
Created November 8, 2019 09:27
markdown-css
```
const config = {
"consumer_key": "00000000-0000-0000-0000-000000000000",
"consumerPrivateKey": "-----BEGIN RSA PRIVATE KEY-----\00000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000\n00000000000000000000000000000
Success: /var/log/boot/cloudSuccess: /var/log/boot/cloud[rancher@rancher ~]$ cat /var/log/boot/cloud-init-save.log
time="2019-08-14T09:41:33Z" level=debug msg="START: [cloud-init-save] in /"
time="2019-08-14T09:41:33Z" level=info msg="Running cloud-init-save"
time="2019-08-14T09:41:33Z" level=info msg=SaveCloudConfig
time="2019-08-14T09:41:33Z" level=debug msg="init: SaveCloudConfig(pre ApplyNetworkConfig): netconf.NetworkConfig{PreCmds:[]string(nil), DHCPTimeout:0, DNS:netconf.DNSConfig{Nameservers:[]string(nil), Search:[]string(nil)}, Interfaces:map[string]netconf.InterfaceConfig(nil), PostCmds:[]string(nil), HTTPProxy:"", HTTPSProxy:"", NoProxy:"", WifiNetworks:map[string]netconf.WifiNetworkConfig(nil), ModemNetworks:map[string]netconf.ModemNetworkConfig(nil)}"
time="2019-08-14T09:41:33Z" level=info msg="Apply Network Config"
time="2019-08-14T09:41:33Z" level=debug msg="Config: &netconf.NetworkConfig{PreCmds:[]string(nil), DHCPTimeout:10, DNS:netconf.DNSConfig{Nameservers:[]string(nil), Search:[]stri