Skip to content

Instantly share code, notes, and snippets.

View m-radzikowski's full-sized avatar

Maciej Radzikowski m-radzikowski

View GitHub Profile
m-radzikowski /
Last active April 7, 2024 20:35
Migrate comments from WordPress wpDiscuz ( to Giscus ( powered by GitHub Discussions
import hashlib
import re
from time import sleep
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
from markdownify import markdownify as md
m-radzikowski / cdk.json
Created March 15, 2023 10:58
Context parameters example for Opinionated CI Pipeline (
"app": "...",
"context": {
"projectName": "myproject",
"environments": {
"default": {
"account": "111111111111",
"region": "us-east-1"
"prod": {
m-radzikowski / cdk.ts
Last active March 15, 2023 10:55
Minimal usage example of Opinionated CI Pipeline (
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: {
m-radzikowski /
Last active May 24, 2021 22:34
Amazon Cognito App Client authorization
#!/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
m-radzikowski / LICENSE
Created December 15, 2020 16:22
This license applies to all public gists
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:
m-radzikowski /
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description:
#!/usr/bin/env bash
set -Eeuo pipefail
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...]
#!/usr/bin/env bash
# Personal script to setup Linux Mint
# and install bunch of tools.
set -euo pipefail
echoerr() { echo "$@" 1>&2; }
ensure_sudo() {
m-radzikowski / DropAllTables
Last active August 29, 2015 14:11
Drops all tables, views and routines in database. Based on
-- 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
m-radzikowski /
Created February 20, 2014 14:17
Script to restore Grub2 for openSUSE after for example Windows installation.
# 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
* Twig Filter for Symfony 2 - check if asset exists.
* Modified Alain's Tiemblo code:
* 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: