Skip to content

Instantly share code, notes, and snippets.

@aaira-a
aaira-a / prettify.js
Created January 20, 2023 16:37
Prettify json file using nodejs
const fs = require('fs');
let rawdata = fs.readFileSync('input.json');
let parsed = JSON.parse(rawdata);
let prettified = JSON.stringify(parsed, null, " ");
fs.writeFileSync('output.json', prettified);
@aaira-a
aaira-a / gist:77ae6cc343c72afe3793a116812a1fa3
Created August 26, 2022 11:01
TamperMonkey user script to set text content
// ==UserScript==
// @name Rewrite words
// @description Rewrite words
// @grant GM_log
// @match *://*/*
// @version 1
// ==/UserScript==
setInterval (function() { doReplace() }, 1000);
@aaira-a
aaira-a / gist:6761c5c86e41e03102215d11d4268db7
Last active December 13, 2019 08:06
Selecting CSS and XPath via browser console
CSS = $$("")
XPATH = $x("")
@aaira-a
aaira-a / bfile.rb
Last active June 5, 2018 09:51 — forked from skord/bfile.rb
A simple file server and uploader using sinatra
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'
$pwd = ENV['PWD']
if File.exists?(ARGV.last)
if ARGV.last != 'bfile.rb'
@aaira-a
aaira-a / cs16.txt
Created November 18, 2017 09:19
install counter-strike 1.6 dedicated server using steamcmd
C:\steamcmd>steamcmd.exe
Redirecting stderr to 'C:\steamcmd\logs\stderr.txt'
[ 0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.
Steam>login anonymous
@aaira-a
aaira-a / myerror.js
Created April 11, 2017 00:49
nodejs - stringify js error/object - stolen from http://stackoverflow.com/a/20405830
var stringifyError = function(err, filter, space) {
var plainObject = {};
Object.getOwnPropertyNames(err).forEach(function(key) {
plainObject[key] = err[key];
});
return JSON.stringify(plainObject, filter, space);
};
@aaira-a
aaira-a / getallworkflowversions.ps1
Created August 16, 2016 05:28
get all workflow versions in a site
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll”
#Specify tenant admin and site URL
$SiteUrl = "mysiteurl"
$UserName = "myusername"
$SecurePassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
@aaira-a
aaira-a / getunpublishedworkflowdefinition.ps1
Last active April 28, 2016 05:20
get specific property from a workflow definition including non-published from a context on sharepoint online using powershell csom
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll”
#Specify tenant admin and site URL
$SiteUrl = "mysiteurl"
$UserName = "myusername"
$SecurePassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
@aaira-a
aaira-a / google.py
Created April 8, 2016 00:54
python selenium google search example
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("http://www.google.com")
input_element = driver.find_element_by_name("q")
input_element.send_keys("python")
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll”
#Specify tenant admin and site URL
$SiteUrl = "mysiteurl"
$UserName = "myusername"
$SecurePassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force