Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / .NET6Migration.md
Last active July 1, 2024 01:52
.NET 6 ASP.NET Core Migration
@pat
pat / LICENSE.txt
Last active February 4, 2023 21:02
Running Setup SQL scripts on an RDS instance within a VPC, via Terraform
The MIT License (MIT)
Copyright (c) 2018 Pat Allan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
import com.github.jengelman.gradle.plugins.shadow.ShadowApplicationPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.jfrog.bintray.gradle.BintrayPlugin
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.gradle.api.publish.maven.MavenPom
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.jfrog.bintray.gradle.BintrayExtension
val kotlinVersion = plugins.getPlugin(KotlinPluginWrapper::class.java).kotlinPluginVersion
@flolas
flolas / teradata_hook.sql
Created January 12, 2018 12:55
Teradata Hook for Apache Airflow using PyTd (Teradata Python Module)
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@vitalyisaev2
vitalyisaev2 / personal_access_token.py
Last active April 26, 2024 05:02
Script for obtaining Gitlab API Personal Access Token
#!/usr/bin/python3
"""
Script that creates Personal Access Token for Gitlab API;
Tested with:
- Gitlab Community Edition 10.1.4
- Gitlab Enterprise Edition 12.6.2
- Gitlab Enterprise Edition 13.4.4
"""
import sys
import requests
@kellyrmilligan
kellyrmilligan / s3Sync.sh
Created June 8, 2017 13:38
Sync files to s3 and set cache control headers
#!/bin/bash
if [[ "$1" != "" ]]; then
S3BUCKETNAME="$1"
else
echo ERROR: Failed to supply S3 bucket name
exit 1
fi
aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@EntropyWorks
EntropyWorks / add-ssh-keys.yml
Last active March 29, 2022 21:04
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
@secretorange
secretorange / ConditionalAnchorTagHelper.cs
Last active February 17, 2019 16:23
ASP.NET 5 Conditional Anchor Tag Helper. This tag helper will omit the anchor tag if the href is null or empty.
namespace SecretOrange
{
[HtmlTargetElement("a", Attributes = "asp-conditional")]
public class ConditionalAnchorTagHelper : TagHelper
{
public override async void Process(TagHelperContext context, TagHelperOutput output)
{
var href = context.AllAttributes["href"]?.Value.ToString();
if (String.IsNullOrWhiteSpace(href))
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {