Skip to content

Instantly share code, notes, and snippets.

View Warrenn's full-sized avatar

Warrenn Enslin Warrenn

  • Busyweb
  • South Africa
View GitHub Profile
@Warrenn
Warrenn / EventAwaiter.cs
Created April 29, 2022 20:55
await events using Task
namespace Auto_Invest;
public static class EventAwaiter
{
public class EventArg<T>
{
public T? Args { get; set; }
public object? Sender { get; set; }
}
cat <<'EOF' > $IBEAM_GATEWAY_DIR/san.tmpl
[req]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
cat <<'EOF' > /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent-schema.tmpl
{
"agent": {
"run_as_user": "root"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
$images=$(docker ps);$imageid=$images[1].Split(' ')[0];docker kill $imageid
S3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
BucketName:
Fn::Join:
- "-"
@Warrenn
Warrenn / wrenchmonkey.js
Created January 29, 2021 16:20
Makes AWS automatically do a push on DUO
// ==UserScript==
// @name
// @version 1.0
// @description Makes AWS automatically do a push on DUO
// @match https://domain/console/
// @grant GM_addStyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require http://static-file-cdn.s3-website.us-east-2.amazonaws.com/js/waitForKeyElements.js
// ==/UserScript==
waitForKeyElements ("#wdc_mfa", actionFunction);
@Warrenn
Warrenn / GetCallingSourceType.cs
Last active January 26, 2021 10:35
stackTraceSource
private static Type GetCallingType()
{
var stack = new StackTrace();
var currentType = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType;
var callingType = currentType;
var frames = stack.GetFrames() ?? new StackFrame[] { };
foreach (var frame in frames)
{
var method = frame.GetMethod();
@Warrenn
Warrenn / dynamicBuilder.cs
Created December 15, 2020 12:35
dynamic type builder
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace TypeBuilderNamespace
{
public static class MyTypeBuilder
{
public static void CreateNewObject()
{
public void InitializeDatabase(YourDbContext context)
{
if (!context.Database.Exists() || !context.Database.CompatibleWithModel(false))
{
var configuration = new DbMigrationsConfiguration();
var migrator = new DbMigrator(configuration);
migrator.Configuration.TargetDatabase = new DbConnectionInfo(context.Database.Connection.ConnectionString, "System.Data.SqlClient");
var migrations = migrator.GetPendingMigrations();
if (migrations.Any())
{
openssl s_client -connect 13.226.49.64:443 -servername api-help.rendrneuro.com