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
func handler(ctx context.Context, ev events.S3Event) { | |
// need to handle PUT, DELETE, UPDATE, separately | |
for _, record := range ev.Records { | |
switch record.EventName { | |
case "INSERT": | |
fmt.Printf("%+v\n", record) | |
var rr localTypes.ActivityEventsTable | |
UnmarshalStreamImage(record.Change.NewImage, rr) |
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 without sharing class CustomController { | |
// this value cannot be read inside the testing, make sure you insert temporary value | |
public static final String endpoint = Custom_Setting__c.getOrgDefaults().custom_endpoint__c; | |
public static String getAuthHeader() { | |
Auth.JWT jwt = new Auth.JWT(); | |
jwt.setSub(UserInfo.getUserId()); | |
Map<String, String> claims = new Map<String, 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
// this is a mock code, will not compile | |
func getToken(ctx context.Context) (string, error) { | |
secretsmanagerwrapper.NewSecretsManager(context) | |
xray.AWS(secretsmanagerwrapper.Client()) | |
var token | |
token = secretsmanagerwrapper.GetSecrets(strings.Replace(c.Host(), "-", "", -1)) | |
if token == "" { | |
return nil, errors.New("failed to get token") | |
} | |
return token, nil |
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 boto3 | |
def getZone(marker): | |
client = boto3.client('route53') | |
# Get list of zones | |
if marker != "": | |
response = client.list_hosted_zones(Marker=marker) | |
else: | |
response = client.list_hosted_zones() | |
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
--- | |
- name: Provision an EC2 Instance | |
hosts: local | |
connection: local | |
gather_facts: False | |
tags: provisioning | |
# Necessary Variables for creating/provisioning the EC2 Instance | |
vars: | |
instance_type: t2.small | |
group_id: ['sg-xxx','sg-xxx'] |
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 | |
P.[publication] AS [Publication Name] | |
,A.[publisher_db] AS [Database Name] | |
,A.[article] AS [Article Name] | |
,A.[source_owner] AS [Schema] | |
,A.[source_object] AS [Table] | |
FROM | |
[distribution].[dbo].[MSarticles] AS A | |
INNER JOIN [distribution].[dbo].[MSpublications] AS P | |
ON (A.[publication_id] = P.[publication_id]) |
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
Param( | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$targetPath | |
) | |
$SharedFolders = get-childitem -recurse -path $targetPath |where {$_.Attributes -eq 'Directory'} | |
foreach($SharedFolder in $SharedFolders) | |
{ | |
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
// | |
// JamesTableViewController.swift | |
// swiftTest | |
// | |
// Created by James Hong on 6/06/2014. | |
// Copyright (c) 2014 James Hong. All rights reserved. | |
// | |
import UIKit |
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
declare @kill varchar(8000) = ''; | |
select @kill=@kill+'kill '+convert(varchar(5),spid)+';' | |
from master..sysprocesses | |
where dbid=db_id('MyDB'); | |
print @kill; | |
exec (@kill); |
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 | |
'create login [' + p.name + '] ' + | |
case when p.type in('U','G') then 'from windows ' else '' end + | |
'with ' + | |
case when p.type = 'S' then 'password = ' + master.sys.fn_varbintohexstr(l.password_hash) + ' hashed, ' + | |
'sid = ' + master.sys.fn_varbintohexstr(l.sid) + | |
', check_expiration = ' + case when l.is_expiration_checked > 0 then 'ON, ' else 'OFF, ' end + | |
'check_policy = ' + case when l.is_policy_checked > 0 then 'ON, ' else 'OFF, ' end + | |
case when l.credential_id > 0 then 'credential = ' + c.name + ', ' else '' end | |
else '' end + |
NewerOlder