Skip to content

Instantly share code, notes, and snippets.

@bendalby82
bendalby82 / iis-log-file-format-grok.txt
Created September 29, 2020 14:43
Grok rule to parse IIS log file format (a fixed ASCII text-based format that cannot be customized)
%{IP:client_ip},%{SPACE}%{NOTSPACE:username},%{SPACE}%{DATE_US:date},%{SPACE}%{TIME:time},%{SPACE}%{WORD:service},%{SPACE}%{HOSTNAME:server_name},%{SPACE}%{IP:server_ip},%{SPACE}%{INT:time_taken_ms},%{SPACE}%{INT:client_bytes_sent},%{SPACE}%{INT:server_bytes_sent},%{SPACE}%{INT:http_status_code},%{SPACE}%{INT:windows_status_code},%{SPACE}%{WORD:http_request_verb},%{SPACE}%{URIPATH:http_verb_target},%{SPACE}%{NOTSPACE:http_parameters},
@mkfares
mkfares / zsh-keyboard-shortucts.md
Last active July 24, 2024 14:26
Common zsh Keyboard Shortcuts on macOS Catalina

Common zsh Keyboard Shortcuts on macOS

Navigation

CTRL + A : Move the cursor to the beginning of the line
CTRL + E : Move the cursor to the end of the line
OPTION + Left Arrow : Move the cursor one word backward
OPTION + Right arrow : Move the cursor one word forward
Left Arrow : Move the cursor one character backward
Right Arrow : Move the cursor one character forward

@alexandramartinez
alexandramartinez / 01-Postman-Scripts.md
Last active June 10, 2024 23:37
Postman scripts cheatsheet

Postman Scripts Cheatsheet

Here you can find some of the most used scripts for Postman testing.

At least some of the most used by me :-)

Postman Objects

(pm-objects.js)

  • Global variables
  • Environment variables
@maphew
maphew / arcpy-overhead.py
Last active March 11, 2020 13:00
What is your "import arcpy" overhead?
'''Measure and report the time it takes to simply `import arcpy`
Part of https://community.esri.com/message/914048-re-what-is-your-import-arcpy-overhead?
'''
from timeit import default_timer as timer
start = timer()
from datetime import datetime, timedelta
from uuid import uuid4
eventid = datetime.now().strftime('%Y%m-%d%H-%M%S-') + str(uuid4())
@SMSAgentSoftware
SMSAgentSoftware / New-WizTreeDiskUsageReport.ps1
Created August 15, 2018 13:27
Creates csv and html disk usage reports using WizTree portable
# Script to export html and csv reports of file and directory content on the system drive
# Use to identify large files/directories for disk space cleanup
# Uses WizTree portable to quickly retrieve file and directory sizes from the Master File Table on disk
# Download and extract the WizTree64.exe and place in the same directory as this script
# Set the running location
$RunLocation = $PSScriptRoot
#$RunLocation = "C:\temp"
$TempLocation = "C:\temp"
@nygeog
nygeog / csv-to-shapefile-geopandas.py
Last active July 18, 2024 00:31
Read a CSV with Pandas and set as GeoDataFrame with geopandas and save as Shapefile with fiona
import pandas as pd
from geopandas import GeoDataFrame
from shapely.geometry import Point
import fiona
df = pd.read_csv('data.csv')
geometry = [Point(xy) for xy in zip(df.x, df.y)]
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry)
@kingspp
kingspp / logging.py
Created April 22, 2017 07:14
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup
@JeffJacobson
JeffJacobson / GetArcGis-Token.ps1
Last active March 30, 2023 20:32
ArcGIS Online / Portal Powershell scripts
class Token {
[string] $token
[System.DateTimeOffset] $expires
Token($response) {
$this.token = $response.token;
$this.expires = [System.DateTimeOffset]::FromUnixTimeMilliseconds($response.expires)
}
}
$rootUri = "https://www.arcgis.com/sharing/rest"
@jgravois
jgravois / post.py
Last active April 22, 2022 18:15
what's required to use python requests to POST to AGOL/ArcGIS Server?
import requests
import json
agol_url = r'http://services1.arcgis.com/uRIm5IkWjDXybgFb/arcgis/rest/services/LA_Nhood_Change/FeatureServer/0/query'
server_url = r'http://sampleserver6.arcgisonline.com/arcgis/rest/services/EmergencyFacilities/FeatureServer/0/query'
# i tried several different headers, to no avail
# headers={"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
# headers = {"Content-Type": "application/x-www-form-urlencoded", "Accept":"/*/", "Accept-Encoding":"gzip, deflate", "Accept-Language":"en-US,en;q=0.8,ar;q=0.6"}
headers={"content-type":"application/json","Accept":"application/json"}