Skip to content

Instantly share code, notes, and snippets.

View joshschmelzle's full-sized avatar
👻
༼ つ ◕_◕ ༽つ🛜

jsz joshschmelzle

👻
༼ つ ◕_◕ ༽つ🛜
View GitHub Profile
@joshschmelzle
joshschmelzle / cURL-for-testing-HTTP-response.md
Created December 4, 2017 17:47
Using cURL to test HTTP response time

cuRL - Measuring HTTP Response Time

A way of measuring HTTP Response Time with cURL.

  • curl is used to transfer data to and from a server
  • in this example curl is used to measure website response time

Usage:

  • curl -w "@curl-format.txt" -o -s www.costco.com
@joshschmelzle
joshschmelzle / nslookup-specific-name-server.md
Created December 6, 2017 15:40
Using nslookup to check DNS from a specific name server

Syntax:

  • nslookup <name> <server>

Where is the DNS hostname and is the hostname or IP address of the name server.

Example:

  • nslookup www.yahoo.com 8.8.8.8
@joshschmelzle
joshschmelzle / logstash-wing-syslog.conf
Last active December 13, 2017 18:55
logstash-wing-syslog.conf
input {
tcp {
port => 514
type => syslog
}
udp {
port => 514
type => syslog
}
}
@joshschmelzle
joshschmelzle / wifi.bat
Last active May 23, 2018 19:13
Modified Wi-Fi batch file. Originally created by Tom Carpenter
@ECHO OFF
if [%1]==[] GOTO MENU
if /I %1==interfaces GOTO SHOWALL
if /I %1==networks GOTO NETWORKS
if /I %1==drivers GOTO DRIVERS
if /I %1==settings GOTO SETTINGS
@joshschmelzle
joshschmelzle / doskey_macros.bat
Last active December 29, 2017 16:37
doskey macro loader for win32 systems
@echo off
cd C:\
REM This batch file loads up doskey macros from a file.
REM Additionally it displays a random quote from a file to inspire the reader.
REM ::: MACROS START :::
title Free Your Mind %1
REM Create a .bat or .cmd file with your DOSKEY commands.
REM Run regedit and go to HKEY_CURRENT_USER > Software > Microsoft > Command Processor.
@echo off
title The Matrix
color 0a
:h
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
color 0b
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
color 0c
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
color 0d
@joshschmelzle
joshschmelzle / list-ssh-sessions.md
Last active November 16, 2024 19:11
List all connected SSH sessions

How to list all connected SSH sessions

I was curious how to view sessions on a Linux box I had at my desk. Similar to the session table on an Aruba controller (show loginsessions). Here are some ways you can list active SSH sessions; some commands return more output than others. This applies to most modern Linux boxes or say a WLAN Pi.

All examples below are using 2 MobaXterm user sessions from a Windows machine to a Linux 4.14.42-sunxi64 aarch64 (NanoPi NEO2).

w

wlanpi@wlanpi:~$ w
@joshschmelzle
joshschmelzle / now.bat
Last active May 30, 2018 12:34
Prints the local date and time in ISO format to the screen on a Windows machine
@echo off
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo local time is %ldt%
@joshschmelzle
joshschmelzle / resequence.py
Created November 28, 2018 18:18
Iterates through ESS accessPoints.json objects and renames APs.
import json
json_data = object()
with open('accessPoints.json') as f:
json_data = json.load(f)
x = 1
for i in json_data['accessPoints']:
@joshschmelzle
joshschmelzle / netsh_quality_to_rssi_example.py
Last active June 29, 2019 02:36
Convert Signal Quality to RSSI using Python (short version)
"""
- there are known issues with this approach.
- consider that this does not force the driver to refresh it's RSSI reading.
- if you want to monitor RSSI, you need to use the wlanapi.
"""
import subprocess
command = ['netsh', 'wlan', 'show', 'interface']
out = subprocess.check_output(command)
out = out.decode("utf-8").lower()