This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = None | |
for index in range(0,5): | |
row1 = {'text': f'this is text', 'skills': [{"skill": "Credit", "confidence": 0.53}], 'error': 93} | |
row_df = pd.DataFrame(row1, index=[f'abcd{index}']) | |
if df is None: | |
df = row_df | |
else: | |
df = df.append(row_df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--STEP 1: Create Employees | |
SET numberOfEmployees = 20000; | |
CREATE OR REPLACE TEMPORARY TABLE employees ( | |
ROWID INT, | |
MANAGERID VARCHAR(255), | |
MANAGERFIRSTNAME VARCHAR(50), | |
MANAGERLASTNAME VARCHAR(50), | |
EMPLOYEEID VARCHAR(255), | |
EMPLOYEEFIRSTNAME VARCHAR(50), | |
EMPLOYEELASTNAME VARCHAR(50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
var source = new CancellationTokenSource(); | |
var cancellationToken = source.Token; | |
var tasks = new List<Task> | |
{ | |
Task.Run(async () => await ATask(TimeSpan.FromMilliseconds(2600), cancellationToken), cancellationToken), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import time | |
logger = logging.getLogger(__file__) | |
logging.basicConfig( | |
level=logging.INFO, | |
format="%(asctime)s | %(name)s | %(levelname)s | %(message)s",) | |
logging.Formatter.converter = time.gmtime | |
logger.addHandler(logging.StreamHandler()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let correlationId = 'bf125a40-efc8-4414-84f9-cede7aeb1305'; | |
let t = traces | |
| where customDimensions.prop__CorrelationId == correlationId | |
| where message contains 'started' or message contains 'ended' or message contains 'failed' | |
| project timestamp, operation_Id, operation_Name, function = substring(message, 0, indexof(message, " ")), result = substring(message, indexof(message, " "), string_size(message) - indexof(message, " ") - 1); | |
let t2 = t | |
| project timestamp, operation_Id, operation_Name, function, result = case(result contains ".", substring(result, 0, indexof(result, ".")), result); | |
let starts = t2 | |
| extend operation = strcat(operation_Id, ":", function) | |
| extend start = timestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Injection(typeof(ExceptionShieldingAspect))] | |
public class ShieldExceptionsAttribute : Attribute | |
{ | |
} | |
[Aspect(Scope.Global)] | |
public class ExceptionShieldingAspect | |
{ | |
public const string ErrorFormat = "{0} Id: {1}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FeatureFunctions | |
{ | |
private readonly ILogger _logger; | |
private readonly IFlagService _flagService; | |
private readonly IConfigurationRefresher _refresher; | |
public ReminderFeatureFunctions(ILogger<FeatureFunctions> logger, IFlagService flagService, IConfigurationRefresher refresher) | |
{ | |
_logger = logger; | |
_flagService = flagService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("TimerTriggeredFunction1")] | |
public static async Task Handle1( | |
[TimerTrigger("0 */15 7-18 * * *")] TimerInfo timer, ILogger logger) | |
{ | |
if (Convert.ToBoolean(Configuration["keep-db-alive"])) | |
{ | |
logger.LogTrace("Executing logic to keep the db alive."); | |
using (var connection = new SqlConnection(Configuration["connection-string"])) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT T.name AS TableName , | |
C.name AS ColumnName , | |
P.name AS DataType , | |
P.max_length AS Size , | |
CAST(P.precision AS VARCHAR) + '/' + CAST(P.scale AS VARCHAR) AS PrecisionScale | |
FROM sys.objects AS T | |
JOIN sys.columns AS C ON T.object_id = C.object_id | |
JOIN sys.types AS P ON C.system_type_id = P.system_type_id | |
WHERE T.type_desc = 'USER_TABLE' | |
ORDER BY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int counter = 0; | |
int * pointer_to_counter = &counter; | |
int ** pointer_to_pointer = &pointer_to_counter; | |
int *** pointer_to_pointer_to_pointer = &pointer_to_pointer; | |
counter += 1; | |
*pointer_to_counter += 1; |
NewerOlder