Skip to content

Instantly share code, notes, and snippets.

<script>
console.log("Starting inline script to handle button click events.");
function sendAuthenticationEventA(){
alloy("sendEvent", {
"renderDecisions": true,
"xdm": {
@lesutton
lesutton / main.py
Created October 19, 2023 13:58
Python 75kb Sample File Generator
text = "A" * 76000 # This will generate a string with 75,000 "A" characters
# Save to a file
with open("75KB_text.txt", "w") as file:
file.write(text)
import json
# Estimate the number of records needed for 75KB based on the rough size of one record.
@lesutton
lesutton / outliers.py
Created October 2, 2022 19:18
Calculate Outliers
plt.boxplot(dataframe['Age'])
plt.title('Boxplot of Age with Outlier Details Below')
plt.ylabel('Age')
plt.show()
def get_outliers(df):
q1=df.quantile(0.25)
q3=df.quantile(0.75)
IQR=q3-q1
@lesutton
lesutton / boxplot.py
Last active October 1, 2022 19:35
Box Plot
import seaborn as sns
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import warnings
import numpy as np
tips_data=sns.load_dataset('tips')
tips_data.info
@lesutton
lesutton / donut_plot.py
Created October 1, 2022 19:00
Donut Plot
import seaborn as sns
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import warnings
import numpy as np
tips=sns.load_dataset('tips')
tips.day.value_counts()
@lesutton
lesutton / series_or_dataframe.py
Created September 28, 2022 22:19
Series or DataFrame?
import pandas as pd
import numpy as np
ser1 = pd.Series(list('abcd'))
ser2 = pd.Series(np.arange(4))
# <class 'pandas.core.frame.DataFrame'>
df = pd.concat([ser1, ser2], axis=1)
print(type(df))
@lesutton
lesutton / stats.py
Created September 18, 2022 15:05
Python Statistic Examples
import pandas as pd
import numpy as np
df = pd.DataFrame(data =[7, 16, 12, 51, 10, 81, 1, 16, 9, 11, 16])
list = [7, 16, 12, 51, 10, 81, 1, 16, 9, 11, 16]
data = np.array([14, 19, 20, 22, 24, 26, 27, 30, 30, 31, 36, 38, 44, 47])
q3, q1 = np.percentile(data, [75 ,25])
iqr = q3 - q1
@lesutton
lesutton / targetPageParams.js
Created April 21, 2022 12:58
targetPageParams
<script>
function targetPageParams() {
return {
"at_property": "1e55b827-1ca5-b50d-24af-9ef6d12a194c"
};
}
</script>
@lesutton
lesutton / AdobeTargetPreHiding.js
Created April 14, 2022 18:40
Pre-hiding snippet for Adobe Target with asynchronous tags deployment
<script>
//prehiding snippet for Adobe Target with asynchronous tags deployment
;(function(win, doc, style, timeout) {
var STYLE_ID = 'at-body-style';
function getParent() {
return doc.getElementsByTagName('head')[0];
}
function addStyle(parent, id, def) {
if (!parent) {
return;
@lesutton
lesutton / AdobeTargetDataLayerEventPush.js
Last active April 27, 2022 18:22
Adobe Target Data Layer Event Push
<script>
console.log("Adobe Target: Setting event listener: adobe.target.event.REQUEST_SUCCEEDED");
document.addEventListener(adobe.target.event.REQUEST_SUCCEEDED, function(e) {
console.log("Adobe Target: Event detected");
var tokens = e.detail.responseTokens;