Skip to content

Instantly share code, notes, and snippets.

View 1k-off's full-sized avatar

Bogdan Kosarevskyi 1k-off

View GitHub Profile
@1k-off
1k-off / show_github_actions_secrets.yml
Created June 30, 2022 10:39
Github action to show secret
name: Show secrets
on: [push]
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Check out code
@1k-off
1k-off / bitbucket_remove_users_from_repos.sh
Created May 3, 2023 11:00
Script for removal all users except a list from all repos in a file. Do not forget to update vars section.
#!/usr/bin/env bash
###
# You will need a file `repos` with the list of repos in the next format:
# https://bitbucket.org/workspace/repo-slug/src/master/
###
### VARS ###
clientId="wu" # get from bb oauth consumer
clientSecret="TY" # get from bb oauth consumer
callbackUrL="http://localhost:8000/callback" # do not touch. Set this as a callback url in the bitbucket oauth consumer.
appPassword="ATBB" # get from bb personal settings
FROM golang:1-alpine as build
WORKDIR /src
RUN apk update && apk add --no-cache ca-certificates git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
WORKDIR /src/cmd/ccc
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/ccc
WORKDIR /src/cmd/ccc-cli
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/ccc-cli
@1k-off
1k-off / Backup-All-SqlDatabases.ps1
Created July 26, 2022 13:39
Backup sql databases
Import-Module SqlServer
$DatabaseInstances = @(
"SQL2017",
"SQL2019"
)
$ServerNameUserFriendly = "web"
$DaysToStore = 4
$CurrentDate = $(Get-Date -Format "dd-MM-yyyy")
$BackupPathGeneral = "\\u123456.your-storagebox.de\backup\DataBases\$ServerNameUserFriendly\$CurrentDate"
@1k-off
1k-off / Migrate-IISWebsites.ps1
Created April 27, 2022 10:48
Migrate IIS websites with their bindings and configurations
param (
[Parameter(ParameterSetName="Task", Mandatory)]
[string]$Task
)
Import-Module WebAdministration
function ExportConfigurations {
param (
$WebsiteList
)
@1k-off
1k-off / Dockerfile
Created April 22, 2022 21:31
Build golang app with embedded python to docker scratch
FROM golang:1-alpine as build
WORKDIR /app
RUN apk update && apk add --no-cache ca-certificates
COPY go.mod go.sum ./
RUN go mod download
COPY . .
WORKDIR /app/cmd/tkp
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/tkp
FROM python:3.10 as integration
@1k-off
1k-off / article.md
Last active December 1, 2021 19:03

How to build Umbraco Cloud: the fresh approach

Surprisingly, all the articles that describe setting up CI/CD using Azure DevOps end up at the deployed-somewhat-to-somewhere status. I mean, they take csproj or sln, build it using MSBuild, and transfer the artifact to the release pipeline, in which the artifact is deployed to the web app. But often, this is not the result that we really want to get.

Most likely, we are configuring the CI/CD to provide a unified build and

@1k-off
1k-off / build_inventory.sh
Created November 23, 2021 22:37
Build ansible inventory from SSH config
#!/usr/bin/env bash
keybasepath="$HOME/.ssh/"
cat $HOME/.ssh/config | awk -v RS= -v FS=\\n -v IGNORECASE=1 -v keybasepath="$keybasepath" '
{
ip = ""
alias = ""
id_file = ""
username = ""
port = ""
result = ""
parameters:
- name: Environment
displayName: Environment
type: string
default: 'Development'
values:
- Development
- Staging
- Production