Skip to content

Instantly share code, notes, and snippets.

View gsaslis's full-sized avatar

Yorgos Saslis gsaslis

View GitHub Profile
@jefferyb
jefferyb / insecure-registries-with-podman.md
Created January 19, 2022 04:03
Configure podman to work with insecure registries... Using MicroK8s’ built-in registry

How to configure podman to work with insecure registries

Working with MicroK8s’ built-in registry

$ microk8s enable registry

# or if you want to specify the amount of storage to be added. E.g., to use 40Gi:
$ microk8s enable registry:size=40Gi
@kaaquist
kaaquist / podman_macos.md
Last active July 29, 2024 09:13
Podman with docker-compose on MacOS.

Podman with docker-compose on MacOS.

Podman an alternative to Docker Desktop on MacOS

Getting podman installed and started is super easy.
Just use brew to install it.

> brew install podman

Now since podman uses a VM just like the Docker Client on MacOS we need to initialize that and start it.

@xbmcnut
xbmcnut / shelly_pir.yaml
Last active May 20, 2024 01:01
Making an outdoor motion sensor smart using a Shelly 1
/**
* I figured out you can fit a Shelly 1 inside the case of many outdoor motion sensors.
* Coupled with that fact that recently, Shelly added a feature to de-couple the switch from the relay
* so they act independently, makes this a great combo! Simply wire the output of the PIR motion sensor
* (the wire that normally goes to your outdoor light) to the switch input of the Shelly and wire
* the lightbulb to the L output of the Shelly. Then, in the Shelly app or directly via the devices webpage,
* select the button type as 'Detached Switch' and use the code below to make it work normally.
* Don't forget to adjust the daylight sensitivity to full daylight if you want the motion detection to work 24/7.
*/
@bestie
bestie / wat_gems.rb
Created November 28, 2017 14:16
Parse the Gemfile.lock file and print the list of Gems that Bundler would install
require "bundler"
bundle = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
gem_name_version_map = bundle.specs.map { |spec|
[
spec.name,
spec.version.to_s,
]
}
@michaellihs
michaellihs / SemVer.groovy
Created April 12, 2017 21:42
Semantic Versioning class for Groovy
enum PatchLevel {
MAJOR, MINOR, PATCH
}
class SemVer implements Serializable {
private int major, minor, patch
SemVer(String version) {
def versionParts = version.tokenize('.')
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fluentd
spec:
template:
metadata:
labels:
app: logging
@tdakanalis
tdakanalis / A Guide For Session Persistence With JAAS On Tomcat.md
Last active August 29, 2015 14:23
Tomcat - Session Persistence With JAAS Realm

In Tomcat you can use the PersistentManager in order to swap active (but idle) sessions out to a persistent storage mechanism, as well as to save all sessions across a normal restart of Tomcat. Moreover, the JAASRealm is an implementation of the Tomcat Realm interface that authenticates users through the Java Authentication & Authorization Service (JAAS) framework.

However, the problems start when the PersistentManager deserializes the persisted sessions but the built in JAAS authenticators are not able to find any user principal in those sessions and as a result the user is asked to provide their credentials. The cause of the problem is that as it has been documented in the org.apache.catalina.session.StandardSession class:

/**
 * The authenticated Principal associated with this session, if any.
 * <b>IMPLEMENTATION NOTE:</b>  This object is <i>not</i> saved and
 * restored across session serializations!
 */
@sighingnow
sighingnow / Makefile
Last active October 4, 2024 05:08
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
@danrigsby
danrigsby / packer-ami-id
Last active December 14, 2023 15:07
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@JaniJegoroff
JaniJegoroff / 01_launch.rb
Created March 27, 2014 14:03
Xcode 5.1 / Simulator 7.1: Enable accessibility workaround
Before do |scenario|
enable_accessibility
@calabash_launcher = Calabash::Cucumber::Launcher.new
unless @calabash_launcher.calabash_no_launch?
@calabash_launcher.relaunch
@calabash_launcher.calabash_notify(self)
end
end