Skip to content

Instantly share code, notes, and snippets.

View plavjanik's full-sized avatar

Petr Plavjaník plavjanik

View GitHub Profile
@plavjanik
plavjanik / 0_reuse_code.js
Created May 20, 2014 12:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@plavjanik
plavjanik / auth_sharepointonline.py
Created June 28, 2016 16:10 — forked from brianrusso/auth_sharepointonline.py
Quick and dirty example of how to authenticate to Office 365 SharePoint Online using urllib2, jinja2, cookielib. Basically you POST your user/pass to Microsoft's token service, then hand that token to SharePoint's login proper, which gives you a cookie to access SharePoint content.
import urllib2
import cookielib
import urlparse
import jinja2
from urllib2 import HTTPCookieProcessor
from lxml import etree
# Setup Jinja for SAML
JINJA_TEMPLATE_PATH = "/Users/Brian/IdeaProjects/yggdrasil/templates"
JINJA_ENVIRONMENT = jinja2.Environment(
@plavjanik
plavjanik / splunk_download_search_result.py
Created March 22, 2017 15:33
Download Splunk result in multiple parts
from __future__ import print_function
import base64
import os
import sys
from datetime import datetime, timedelta
from pprint import pprint
from time import sleep
import splunklib.client as client
@plavjanik
plavjanik / brightside_dbus_unlock_jenkins.sh
Last active August 21, 2018 10:57
This unlocks keyring that is necessary for secure secret storage that is used by Brightside
#!/usr/bin/env bash
#
# This unlocks keyring that is necessary for secure secret storage that is used by Brightside
# Tested on CentOS 7
#
# Usage: . ./unlock_keyring_for_bright.sh
#
## Test for an existing bus daemon, just to be safe:
@plavjanik
plavjanik / create_zfs.jcl
Last active June 12, 2024 07:26
JCL that creates a zFS filesystem on z/OS
${jobcard}
//DEFINE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE CLUSTER (NAME(${prefix}.ZFS) -
LINEAR -
TRACKS(80000 80000) -
SHAREOPTIONS(3))
//CREATE EXEC PGM=IOEFSUTL,REGION=0M,COND=(0,LT),
// PARM=('format -aggregate ${prefix}.ZFS')
@plavjanik
plavjanik / rocket_activate.sh
Last active April 11, 2019 21:04
Activation script for Rocket Software open-source on z/OS
# Runtime options require by Rocket open-source:
export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
export _BPXK_AUTOCVT=ON
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export _BPX_SHAREAS=YES
export _BPX_SPAWN_SCRIPT=YES
export ROCKET_HOME=${rocket_home}
@plavjanik
plavjanik / index.js
Created April 12, 2019 19:38
VSAM example
const os = require('os');
const vsam = require('vsam.js');
const vsamDsn = os.userInfo().username + '.TEST.VSAM.KSDS';
const schema = {
key: {
type: "string",
maxLength: 5
},
@plavjanik
plavjanik / binary_search_pysnooper.py
Created May 12, 2019 19:43
PySnooper Example with Binary Search
import pysnooper
@pysnooper.snoop()
def binary_search(sorted_collection, item):
left = 0
right = len(sorted_collection) - 1
while left <= right:
midpoint = (left + right) // 2
current_item = sorted_collection[midpoint]
@plavjanik
plavjanik / macos.reg
Created July 29, 2019 21:26
Wine macOS Settings
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Wine\Mac Driver]
"LeftCommandIsCtrl"="Y"
"RightCommandIsCtrl"="Y"
"LeftOptionIsAlt"="Y"
"RightOptionIsAlt"="Y"
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
@plavjanik
plavjanik / quicksort.hs
Created August 12, 2019 14:56
Quicksort in Haskell
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
where
lesser = filter (< p) xs
greater = filter (>= p) xs