Skip to content

Instantly share code, notes, and snippets.

View stevenriggs's full-sized avatar
🙃

Steven Riggs stevenriggs

🙃
View GitHub Profile
@stevenriggs
stevenriggs / json_test.spl
Created June 9, 2022 14:25
Splunk: Create fake JSON data for SPL testing
| makeresults
| eval _raw="{ \"Name\": \"This is a name\",
\"Items\": [
{
\"path\": \"The 1 path\"
},
{
\"path\": \"The 2 path\"
},
{
# Get the url from the download link in your GitHub repo under Code > Download ZIP
$url = 'https://github.com/YOUR_ORG/YOUR_REPO/archive/refs/heads/master.zip'
$wc = New-Object -TypeName System.Net.WebClient
$wc.Headers.Add('Authorization','token YOUR_GITHUB_PERSONAL_ACCESS_TOKEN')
$wc.DownloadFile($url,'/PATH_TO/master.zip')
Expand-Archive /PATH_TO/master.zip /PATH_TO/master
@stevenriggs
stevenriggs / fetch-error-handling.js
Created February 17, 2021 13:50
React Fetch error handling
fetch("/api/foo").then( response => {
if (!response.ok) { throw response }
return response.json() //we only get here if there is no error
})
.then( json => {
this.props.dispatch(doSomethingWithResult(json))
})
.catch( err => {
if (err.text) {
err.text().then( errorMessage => {
@stevenriggs
stevenriggs / PageControl.js
Last active December 18, 2019 16:48
Nice, super-large pagination control from React-Bootstrap
import React from 'react';
import Container from 'react-bootstrap/Container';
import Pagination from 'react-bootstrap/Pagination';
class PageControl extends React.Component {
render() {
let active = this.props.currentPage;
let items = [];
// the layout...
@stevenriggs
stevenriggs / renoise_launcher.bat
Created March 22, 2016 22:24
Launch Renoise instance with specific preferences
REM ## Renoise Launcher for Windows-based systems ##
REM See http://goo.gl/XxQHmW for details
REM Specify the name of 'your' config.xml - one for each instance
set my_config="Config1.xml"
REM Set codepage to UTF (required if your username contains special characters)
chcp 65001
REM Set up our paths - depends on OS & installed version of Renoise
If you like to return multiple values from a function, simply populate a hash table variable in function and return the variable. See my example below. Feel free to use my example function and Enjoy.
Function Get-UserInfo($username)
{
#Create an hashtable variable
[hashtable]$Return = @{}
Import-Module ActiveDirectory
@stevenriggs
stevenriggs / create-test-log-data.sh
Last active November 3, 2016 13:14
Simulates a rotating log file on Linux/UNIX
#!/bin/sh
# Debug mode 0 = off, 1 = on
blnDebugMode="1"
strLogFolderPath="/var/log/temptestlogs"
# INITIAL VARIABLES
intMinutesTillNewLogFile="1"
intWriteFrequencyInSeconds="1"
strLogText="This is a line"
@stevenriggs
stevenriggs / LinuxFolderSizes.sh
Created March 22, 2015 02:08
Linux folder sizes
#Linux folder sizes
du -sh /*
#I often need to find the biggest directories, so to get a sorted list containing the 20 biggest dirs I do this:
du -m /some/path | sort -nr | head -n 20
@stevenriggs
stevenriggs / altiris_agent_uninstall.vbs
Created March 22, 2015 01:39
Complete uninstall of 6.x Altiris agent
' Purpose: Complete uninstall of 6.x Altiris agent
' Reference: https://kb.altiris.com/article.asp?article=1995&p=1
' Created: 5/17/2010
' Modified: 5/20/2010
' Author: Steven Riggs
Option Explicit
On Error Resume Next
@stevenriggs
stevenriggs / RemoteAltirisUpdate.vbs
Last active August 29, 2015 14:17
This script forces the Altiris Agent on a remote computer to update its configuration from the Notification Server
'This script forces the Altiris Agent on a remote computer to
'update its configuration from the Notification Server
'
'Revised 03/23/11 by Steven Riggs
'Example: cscript.exe RemoteAltirisUpdate.vbs somecomputername
'Or doubleclick on the vbs file to get an input box
Option Explicit