Skip to content

Instantly share code, notes, and snippets.

@rolandyoung
rolandyoung / verifyToken.sh
Last active July 8, 2022 11:16
Using openssl to verify a JWT from Keycloak
#!/bin/bash
# tested with OpenSSL 1.0.1e-fips on Centos 6
# Note hardcoded Keycloak URL and credentials.
# Keycloak public key is in ATS-ci.key.pem with -----BEGIN PUBLIC KEY----- (etc)
assert() { if [[ $1 != $2 ]]; then echo "assert" $3; exit; fi }
url=http://192.168.10.221:8088/auth/realms/ATS-ci/protocol/openid-connect/token
resp=$(curl -X POST $url \
@marchold
marchold / Android SwitchPlusClickPreference
Last active November 20, 2022 09:38
extension of SwitchPreference that allows you to add a click handler to the preference area as well as the switch. For making switch preferences that work like Android WiFi settings.
import android.content.Context;
import android.preference.SwitchPreference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
/**
* Custom preference for handling a switch with a clickable preference area as well
@marteinn
marteinn / InteractiveScrollView.java
Last active May 2, 2023 22:35
ScrollView with a OnBottomReachedListener for Android. MIT license (https://opensource.org/licenses/MIT).
package se.marteinn.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ScrollView;
/**
* Triggers a event when scrolling reaches bottom.
@claylo
claylo / jira.sql
Created April 25, 2011 21:54
Atlassian JIRA database & user creation for MySQL.
#
# You will want to pick a real password here!
#
CREATE USER 'jirauser'@'localhost' IDENTIFIED BY 'some_pass';
CREATE DATABASE jira CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON jira.* to 'jirauser'@'localhost';
FLUSH PRIVILEGES;
# In case you forgot to change the password above...
# SET PASSWORD for 'jirauser'@'localhost' = PASSWORD('someother_pass');