Skip to content

Instantly share code, notes, and snippets.

View d-oderbolz's full-sized avatar

Dr. Daniel C. Oderbolz d-oderbolz

  • SBB CFF FFS
  • Switzerland
View GitHub Profile
var SubststitutionHelper = Class.create();
SubststitutionHelper.prototype = {
initialize: function(record) {
this.log = new GSLog("intuit.custom.debug.level", this.type);
this.record = record;
// preload variables for request item
this.variables = {};
if(this.record.getTableName() == 'sc_req_item'){
this.preloadVariables();
}
@hunterowens
hunterowens / connect_and_load.py
Last active December 9, 2023 16:27
Pandas and MSSQL
import pymssql
import pandas as pd
## instance a python db connection object- same form as psycopg2/python-mysql drivers also
conn = pymssql.connect(server="172.0.0.1", user="howens",password="some_fake_password", port=63642) # You can lookup the port number inside SQL server.
## Hey Look, college data
stmt = "SELECT * FROM AlumniMirror..someTable"
# Excute Query here
df = pd.read_sql(stmt,conn)

Replace yourdomain with your service now URL. User must have the rest_service role.

@groue
groue / synchronize.swift
Last active March 9, 2021 16:02
How to synchronize an SQLite table with a JSON payload using https://github.com/groue/GRDB.swift
// This sample code shows how to use GRDB to synchronize a database table
// with a JSON payload. We use as few SQL queries as possible:
//
// - Only one SELECT query.
// - One query per insert, delete, and update.
// - Useless UPDATE statements are avoided.
import Foundation
import GRDB
@icerge
icerge / stop_watch.md
Last active July 24, 2023 11:11
Timer in SN - GlideStopWatch

Watch out performance of your queries!

var sw = new GlideStopWatch();  
var recGR = new GlideRecord('cmdb_ci');  
recGR.addQuery('sys_class_name', 'INSTANCEOF', 'cmdb_ci_server');  
recGR.addQuery('name', 'ABCDEF');  
recGR.setLimit(1);  
recGR.query();  
if (recGR.hasNext()) { 
@e0x70i
e0x70i / powershell upload to dropbox powershell 2
Created May 25, 2017 08:28
Powershell upload to dropbox converted to powershell2
<#
Ported to powershell2 from script by Laurent Kempé
http://laurentkempe.com/2016/04/07/Upload-files-to-DropBox-from-PowerShell/
.SYNOPSIS
This is a Powershell script to upload a file to DropBox using their REST API.
.DESCRIPTION
This Powershell script will upload file to DropBox using their REST API with the parameters you provide.
@angelo-v
angelo-v / jwt-decode.sh
Last active July 12, 2024 09:51
Decode a JWT via command line
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904
function jwt-decode() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
jwt-decode $JWT
@thisnameissoclever
thisnameissoclever / JournalRedactor.js
Last active April 6, 2024 08:28
Redact or delete a given journal entry in ServiceNow. Usage documentation: http://redactor.snc.guru/
/*
Script Include definition:
Name: JournalRedactor
Client Callable: false
Accessible from: All application scopes
Additional details:
Version: 1.3
Usage documentation: http://redactor.snc.guru/
License: https://gist.github.com/thisnameissoclever/767b8a738b929a0bd943965431061c1e
*/
@dsample
dsample / .editorconfig
Last active May 9, 2021 20:29
Some files which I usually include within a repo's 'first commit'
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
indent_style = space
indent_size = 2
@Neo23x0
Neo23x0 / Base64_CheatSheet.md
Last active July 5, 2024 17:29
Learning Aid - Top Base64 Encodings Table

Base64 Patterns - Learning Aid

Base64 Code Mnemonic Aid Decoded* Description
JAB 🗣 Jabber $. Variable declaration (UTF-16), e.g. JABlAG4AdgA for $env:
TVq 📺 Television MZ MZ header
SUVY 🚙 SUV IEX PowerShell Invoke Expression
SQBFAF 🐣 Squab favorite I.E. PowerShell Invoke Expression (UTF-16)
SQBuAH 🐣 Squab uahhh I.n. PowerShell Invoke string (UTF-16) e.g. Invoke-Mimikatz
PAA 💪 "Pah!" &lt;. Often used by Emotet (UTF-16)