Skip to content

Instantly share code, notes, and snippets.

@artizirk
artizirk / export existing ssh private key to opengpg card.md
Last active June 19, 2024 21:50
Export existing private ssh key to OpenPGP card or Yubikey

Export existing private ssh key to OpenPGP card or Yubikey

Before you begin

This will only work with OpenPGP v2.0 or newer or with PIV cards. Your existing ssh key has to be in a format that is supported by your opengpg card. For example my the OpenPGP V2.1 Card from FLOSS Shop supports only 2048 bit RSA keys. RSA exponent should be 65537, Putty and old OpenSSH releases use different expnent that for example Yubikey does not support.

Required software

@Fredx87
Fredx87 / README.md
Last active February 25, 2021 18:11
Swagger UI Keycloak Logout plugin

Swagger UI Keycloak Logout plugin

This is a plugin for Swagger UI that integrates the logout process with Keycloak.

When the user clicks "Logout" the logout page of Keycloak is called and then the user session is removed from Keycloak. To use this plugin you need to include the keycloak-logout.js file in dist/index.html and place oauth2-logout.html in the dist folder.

The logout URL is taken from the authorizationUrl removing the auth string and replacing it with the logout string.

Rember to add OAuthLogoutPlugin to the plugins section of SwaggerUi configuration:

@jgamblin
jgamblin / slackoutlook.scpt
Created April 19, 2017 12:39
Set your slack status based on Outlook calendar.
launch application "Microsoft Outlook"
launch application "Slack"
property startDate : current date
property endDate : startDate + (10 * minutes)
property cachedStatus : ""
property results : {}
property running : true
global emailAddress
@thomasdarimont
thomasdarimont / readme.md
Last active July 1, 2024 09:43
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
@yutannihilation
yutannihilation / grafana-playbook.yml
Last active March 12, 2021 13:39
Ansible Playbook to install Grafana
---
- hosts: HOST
vars:
grafana_version: 2.5.0
arch: amd64
grafana_filename: grafana_{{ grafana_version }}_{{ arch }}.deb
tasks:
- name: Verify version
command: dpkg-query -W --showformat='${version}' grafana
@stickfigure
stickfigure / GuiceResteasyFilterDispatcher.java
Created April 26, 2015 17:51
A better way to integrate Guice and Resteasy
package com.example;
import com.google.inject.Injector;
import org.jboss.resteasy.plugins.guice.ModuleProcessor;
import org.jboss.resteasy.plugins.server.servlet.FilterDispatcher;
import org.jboss.resteasy.spi.Registry;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.servlet.FilterConfig;
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active July 3, 2024 02:22
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@teffalump
teffalump / README.md
Last active June 16, 2024 18:43
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@plentz
plentz / nginx.conf
Last active July 27, 2024 16:11
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@nlochschmidt
nlochschmidt / bootstrapFieldConstructor.scala.html
Last active December 23, 2015 20:09
hack to use Play 2.2 form helper with Bootstrap 3
@(elements: views.html.helper.FieldElements)
@**************************************************
* Generate input according twitter bootsrap rules *
**************************************************@
<div class="input-group @elements.args.get('_class) @if(elements.hasErrors) {has-error}" id="@elements.args.get('_id).getOrElse(elements.id + "_field")">
<label class="sr-only" for="@elements.id">@elements.label(elements.lang)</label>
@elements.input
<div class="control-label" for="@elements.id">@elements.errors(elements.lang).mkString(", ")</div>