Skip to content

Instantly share code, notes, and snippets.

View aleshkashell's full-sized avatar

Aleksey Sheludchenkov aleshkashell

View GitHub Profile
@aleshkashell
aleshkashell / monitor_service.py
Created October 31, 2017 13:13 — forked from piraz/monitor_service.py
Script that monitors a service running on systemd. If service is not running the script will try to start the service.
#!/bin/python
#
# Copyright 2016 Flavio Garcia
#
# 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
#
@aleshkashell
aleshkashell / gist:4ce392a39ace754a2576fc9c67ba351f
Created November 14, 2017 16:32 — forked from JuanCanham/gist:2917132
Simple Google Apps script to update signatures accross a domain
function getSignature() {
//pretty basic function for testing
if ( startupChecks()) { return; }
var email = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getValue().toString();
if ( email === "" ) {
Browser.msgBox("No email selected", "Please select a cell containing a user's email" , Browser.Buttons.OK);
return;
}
var result = authorisedUrlFetch(email, {});
Browser.msgBox(result.getContentText());
@aleshkashell
aleshkashell / gmail_signatures.py
Created November 16, 2017 14:17 — forked from timrichardson/gmail_signatures.py
Use Python, OAuth2 and Google APIs to mass-update gmail signatures of a Google Apps for Work domain. Using a google service account for the credential.
# python 2.7
""" Read data from a spreadsheet to construct an HTML signature, and update users.
This is enough code to get you going.
You have a service account via a project setup on the Google Developer console.
Download the key in json format.
Next you need to go to the domain's Google admin to enable the correct google API.
The scope is API_scopes =['https://apps-apis.google.com/a/feeds/emailsettings/2.0/']
In more detail:
1. Follow the oauth2 notes to make a service account and download a JSON private key as usual. You do that on the developer console. The service account is not linked to any domain, it is just a credential.
@aleshkashell
aleshkashell / gist:3146c4412a80abf753029740eef2f7ec
Created March 12, 2018 20:22 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@aleshkashell
aleshkashell / rke2-commands.md
Created August 1, 2023 09:51 — forked from superseb/rke2-commands.md
RKE2 commands

RKE2 commands

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server