Skip to content

Instantly share code, notes, and snippets.

View circa10a's full-sized avatar
🤷

Caleb Lemoine circa10a

🤷
View GitHub Profile
@circa10a
circa10a / test.service
Last active March 10, 2022 15:48
A Simple Systemd Service
#/etc/systemd/system/test.service
[Unit]
Description=Test Systemd Service
[Service]
ExecStartPre=/usr/bin/echo -e "\033[0;33m Pre start \033[0m"
ExecStart=/usr/bin/sleep 10
ExecStartPost=/usr/bin/echo -e "\033[0;33m Post start \033[0m"
@circa10a
circa10a / create_fs.sh
Last active October 25, 2018 22:24
Create XFS (pv, vg, lv, mount)
#!/usr/bin/env bash
#choose device
pvcreate /dev/sdb
#choose vg name or number (vg01)
vgcreate vg01 /dev/sdb
#volume group show
vgs
@circa10a
circa10a / find_suid.sh
Created December 17, 2017 03:09
find binaries with SUID perms set for potential privilege escalation
find / -user root -perm -4000 -print 2>/dev/null
@circa10a
circa10a / backup_sh_files.sh
Created December 17, 2017 23:00
find command to backup all files of a given file type
#!/bin/bash
find . -name '*.sh' -maxdepth 1 -type f -exec cp {} ./backups/ \;
@circa10a
circa10a / awk.txt
Last active December 18, 2017 18:57
Awk usage
awk '/role/{gsub("<br>",""); print$3}'
grep sed, print column
@circa10a
circa10a / regex.sh
Created December 18, 2017 20:51
bash regex
[[ $input=~ [A-Za-z0-9-]+\/[A-Za-z0-9-]+\:[A-Za-z0-9-]+ ]]; then
@circa10a
circa10a / response.xml
Created April 1, 2018 20:31
medium WSDL response
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:LatLonListZipCodeResponse xmlns:ns1="https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<listLatLonOut xsi:type="xsd:string">&lt;?xml version='1.0'?&gt;&lt;dwml version='1.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='https://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd'&gt;&lt;latLonList&gt;32.9612,-96.8372&lt;/latLonList&gt;&lt;/dwml&gt;</listLatLonOut>
</ns1:LatLonListZipCodeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
@circa10a
circa10a / curl_noaa.sh
Last active April 2, 2018 00:19
medium curl command
curl -H "soapAction: \"https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListCityNames\"" -H "Content-Type: text/xml;charset=UTF-8" --data @test.xml https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php
@circa10a
circa10a / easy-soap-request-index.js
Last active May 24, 2021 23:02
easy-soap-request-index.js
const axios = require('axios-https-proxy-fix');
/**
* @author Caleb Lemoine
* @param {object} opts easy-soap-request options
* @param {string} opts.url endpoint URL
* @param {object} opts.headers HTTP headers, can be string or object
* @param {string} opts.xml SOAP envelope, can be read from file or passed as string
* @param {int} opts.timeout Milliseconds before timing out request
* @param {object} opts.proxy Object with proxy configuration
const soapRequest = require('easy-soap-request');
const fs = require('fs');
// example data
const url = 'https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php';
const sampleHeaders = {
'user-agent': 'sampleTest',
'Content-Type': 'text/xml;charset=UTF-8',
'soapAction': 'https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode',
};