Skip to content

Instantly share code, notes, and snippets.

View grokify's full-sized avatar
👽
Going with it!

John Wang grokify

👽
Going with it!
View GitHub Profile
@amilos
amilos / adaptive-cards.yaml
Created October 14, 2020 13:17
Adaptive cards specification converted to swagger
openapi: 3.0.3
info:
title: Adaptive Cards
description: This is a port of Adaptive Cards schema to swagger editor for exploration
version: 1.3.0
paths: {}
components:
schemas:
AdaptiveCard:
@StevenACoffman
StevenACoffman / opa-vs-casbin.md
Last active April 7, 2024 02:43
OPA vs Casbin

Information in this Gist originally from this github issue, which is outdated.

As @RomanMinkin mentioned, you can also consider Casbin (https://github.com/casbin/casbin). It is the most starred authorization library in Golang. There are several differences between Casbin and OPA.

Feature Casbin OPA
Library or service? Library/Service Library/Service
How to write policy? Two parts: model and policy. Model is general authorization logic. Policy is concrete policy rule. A single part: Rego
RBAC hierarchy Casbin supports role hierarchy (a role can have a sub-role) Role hierarchies can be encoded in data. Also with the new graph.reachable() built-in function queries over those hierarchies are much more feasible now.
RBAC separation of duties Not supported Supported: two roles cannot be assigned together
@mattheworiordan
mattheworiordan / restart.sh
Created August 19, 2017 13:23
Heroku scheduled restarts
#!/bin/sh
# Set up the Heroku scheduler to run this command every hour. See example setup at https://goo.gl/nMCSH3
#
# Requires env vars to be set in Heroku with `heroku config:set`:
# - HEROKU_APP_NAME: this is just the app name in Heroku, i.e. `heroku apps` will list all apps you have access to
# - HEROKU_CLI_USER: Once Heroku CLI is authenticated (https://goo.gl/Qypr4x), check `cat .netrc` (or `_netrc` on Windows),
# look for `login` under `machine api.heroku.com`
# - HEROKU_CLI_TOKEN: As above, but use the `password` field
#
@jgdoncel
jgdoncel / fn_remove_accents.sql
Last active April 19, 2024 12:20
MySQL Function to remove accents and special characters
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue COLLATE utf8_general_ci;;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';
@grokify
grokify / Module1.vb
Last active October 23, 2018 08:58
Using RingCentral .NET SDK with VB.NET for SMS and Presence Notifications
' VB.NET Demo using C# SDK 1.0.0 at:
' GitHub: https://github.com/ringcentral/ringcentral-csharp
' Nuget: https://www.nuget.org/packages/RingCentralSDK/
' Use by adding RingCentralSDK Nuget package
Imports RingCentral
Imports RingCentral.Http
Module Module1
@josephspurrier
josephspurrier / drop_encrypt.go
Last active March 24, 2020 17:48
Golang - Drag and Drop AES Encryption and Decryption
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@TakahikoKawasaki
TakahikoKawasaki / sinatra+ssl.rb
Created December 16, 2014 14:44
Sinatra + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra.
#
require 'sinatra/base'
class Application < Sinatra::Base
configure do
set :bind, '0.0.0.0'
@Potherca
Potherca / the-"deploy-to-heroku-button"-using-shields-io.md
Last active January 31, 2021 06:16
The "Deploy to Heroku" button using Shields.io

The standard button

Although the technology and philosophy behind the 'Deploy to Heroku' Button are quite awesome, the default look may not what you want. For one thing there is a distinct difference between the PNG and SVG versions Heroku has on offer.

Description Image URL
PNG format ![heroku deploy button png] https://www.herokucdn.com/deploy/button.png
SVG format ![heroku deploy button svg] https://www.herokucdn.com/deploy/button.svg
@rgarcia
rgarcia / basic.go
Created June 11, 2014 17:27
golang basic auth transport
import (
"encoding/base64"
"fmt"
"net/http"
)
type BasicAuthTransport struct {
Username string
Password string
}
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)