View cdk.json
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
{ | |
"app": "...", | |
"context": { | |
"projectName": "myproject", | |
"environments": { | |
"default": { | |
"account": "111111111111", | |
"region": "us-east-1" | |
}, | |
"prod": { |
View cdk.ts
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 {CDKApplication} from 'opinionated-ci-pipeline'; | |
import {MyStack} from '../lib/myStack'; | |
new CDKApplication({ | |
stacks: { | |
create: (scope, projectName, envName) => { | |
new MyStack(scope, 'MyStack', {stackName: `${projectName}-${envName}-MyStack`}); | |
}, | |
}, | |
repository: { |
View cognito-app-client-auth.sh
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
#!/usr/bin/env bash | |
# Discover Cognito User Pool and API Gateway params, | |
# authorize with Cognito App Client ID and Secret | |
# and make request to the API. | |
# set Cognito and API Gateway params | |
REGION="eu-west-1" | |
USER_POOL_NAME="apiAuth-dev" | |
CLIENT_NAME="MyServiceClient" |
View LICENSE
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
MIT License | |
Copyright (c) 2020 Maciej Radzikowski | |
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: |
View script-template.sh
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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
View mint-setup.sh
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
#!/usr/bin/env bash | |
# Personal script to setup Linux Mint | |
# and install bunch of tools. | |
set -euo pipefail | |
echoerr() { echo "$@" 1>&2; } | |
ensure_sudo() { |
View DropAllTables
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
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; | |
-- drop tables | |
SET @tables = NULL; | |
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables | |
FROM information_schema.tables | |
WHERE table_schema = (SELECT DATABASE()); -- from currently selected schema | |
SELECT IFNULL(@tables, 'dummy') INTO @tables; -- to prevent error when there are already no tables | |
View RepareGrub2OnOpenSuse.sh
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
#!/bin/sh | |
# openSUSE rescue system login: root | |
fdisk -l | |
mount /dev/sda5 /mnt # assume that linux partition (/) is on /dev/sda5, you can see this after "fdisk -l" command | |
mount --bind /dev /mnt/dev | |
mount --bind /sys /mnt/sys | |
mount --bind /proc /mnt/proc | |
chroot /mnt | |
grub2-mkconfig -o /boot/grub2/grub.cfg | |
grub2-install /dev/sda |
View AssetExistsExtension.php
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
<?php | |
/** | |
* Twig Filter for Symfony 2 - check if asset exists. | |
* | |
* Modified Alain's Tiemblo code: http://stackoverflow.com/a/16906315/2512304 | |
* | |
* Installation: | |
* 1. Add this file to your bundle into src/Acme/DemoBundle/Twig/AssetExistsExtension.php | |
* 2. Update namespace, if your bundle isn't Acme/DemoBundle | |
* 3. Register it in app/config.yml: |
View TruncateHtmlExtension.php
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
<?php | |
/** | |
* Twig Filter for Symfony 2 - truncate HTML string without stripping tags after reach the minimum length of displayed text | |
* Truncates only first-level tags after reach the minimum, so returned text will be >= minimum | |
* Works well with (only?) utf-8 encoding. | |
* | |
* Installation: | |
* 1. Add this file to your bundle into src/Acme/DemoBundle/Twig/TruncateHtmlExtension.php | |
* 2. Update namespace, if your bundle isn't Acme/DemoBundle | |
* 3. Register it in app/config.yml: |