Skip to content

Instantly share code, notes, and snippets.

@cryocaustik
cryocaustik / axios_interceptor.js
Created July 29, 2019 20:56
axios interaceptor to catch errors and perform something on specific cases, returning the error response in all other cases
axios.interceptors.response.use(
response => {
return response
},
error => {
console.log(`interceptor: response | ${error.config.url}`)
if (
error.config &&
!error.config.url.endsWith('/refresh') &&
!error.config.url.endsWith('/token') &&
@cryocaustik
cryocaustik / add_open_with_terminal.reg
Created September 5, 2019 05:35
Adds "Open with Terminal" entry to right click context menu in Windows, to open the target directory/file with Windows Terminal
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with Terminal]
@="Edit with VS Code"
"Icon"="C:\\Users\\REPLACE_ME_WITH_USERNAME\\AppData\\Roaming\\.app_settings\\terminal.ico,0"
[HKEY_CLASSES_ROOT\*\shell\Open with Terminal\command]
@="\"C:\\Users\\REPLACE_ME_WITH_USERNAME\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\windows_terminal]
@cryocaustik
cryocaustik / admin_lte_darkly.css
Created October 25, 2019 02:58
Bootswatch Darkly Theme for Admin LTE Theme
@import "https://stackpath.bootstrapcdn.com/bootswatch/3.4.1/darkly/bootstrap.min.css";
.content-wrapper,
.main-footer,
.info-box,
.box-info,
.box,
.nav-tabs-custom,
.nav-tabs-custom > .tab-content,
.nav-tabs-custom > .nav-tabs > li.active > a,
@cryocaustik
cryocaustik / path_analysis.py
Last active February 20, 2020 21:08
Python script to walk a target directory and output a file of all child paths, grouped by length.
from pathlib import Path
import json
def path_analysis(target_dir, export_path, unix_path=False):
target_dir = Path(target_dir)
export_path = Path(export_path)
files = list({_ for _ in target_dir.rglob("*")})
files.sort(reverse=True, key=lambda x: len(str(x)))
@cryocaustik
cryocaustik / region_parameters_src.sql
Last active May 19, 2020 07:21
MySQL Sample data for Tableau Parameter Refresh on Workbook Open Failing PoC
-- create base tables with sample data
CREATE TABLE IF NOT EXISTS tableau_pub.regions (
id INT NOT NULL,
region VARCHAR(200) NOT NULL,
created_at DATETIME NOT NULL,
modified_at DATETIME NOT NULL
);
INSERT INTO tableau_pub.regions VALUES
(1, 'Africa', NOW(), NOW()),
@cryocaustik
cryocaustik / tableau_poc.md
Last active May 19, 2020 07:38
Description for Tableau Parameter Refresh on Workbook Open Failing proof of concept

Parameter Refresh on Workbook Open Failing

Proof of concept to show the parameter will refresh on opening in Desktop or Web-Authoring but fails when used as a regular workbook on a server.

Steps to Recreate

This workbook uses the TableauServerUser value to pass the username to MySQL and retrieve data allocated to the user. In order to recreate this issue, you will need to pass a user value registered in the Tableau (‘Aleksandr.Skobelev’, ‘John.Smith’, or ‘Jane.Doe’).

  1. Create a data connection (DC1) as a Tableau Extract
  2. Create another data connection (DC2) as live
@cryocaustik
cryocaustik / add_data_tables.js
Created October 1, 2020 01:42
force data tables onto html table in any site
// inject jquery
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// inject data tables
var dt = document.createElement('script');
dt.src = "//cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js";
document.getElementsByTagName('head')[0].appendChild(dt);
var dtcss = document.createElement('link');
<template>
<div class="card">
<div class="card-body">
<div class="card-title">
<h2>
Custom Jitsi
<span class="text-muted ml-auto" v-if="hasJoinMsg">
{{ joinMsg }}
</span>
</h2>
@cryocaustik
cryocaustik / tester.py
Last active July 8, 2021 01:57
Example of using python for RESTful data validation
import requests
import logging
from datetime import datetime
from pathlib import Path
LOG_DIR = Path("./logs")
logger = logging.getLogger("py-api-data-validation")
logging.basicConfig(
level=logging.INFO,
filename=LOG_DIR /
@cryocaustik
cryocaustik / databases.php
Created August 24, 2021 14:48
Laravel MySQL SSL Config
// add to mysql config
'sslmode' => 'require',
'options' => array(
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
PDO::MYSQL_ATTR_SSL_KEY => '/etc/ssl/mysql/client-key.cer',
PDO::MYSQL_ATTR_SSL_CERT => '/etc/ssl/mysql/client-cert.cer',
PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/mysql/server-ca.cer',
),