Skip to content

Instantly share code, notes, and snippets.

View nhocki's full-sized avatar
💭
I may be slow to respond.

Nicolás Hock-Isaza nhocki

💭
I may be slow to respond.
View GitHub Profile
@nhocki
nhocki / MyConnectedAppPlugin.cls
Last active November 2, 2023 21:22
Salesforce connected app plugin to add the AccountID to SAML attributes for community users
global class MyConnectedAppPlugin extends Auth.ConnectedAppPlugin {
global override Map<String,String> customAttributes(Id userId, Id connectedAppId, Map<String,String>
formulaDefinedAttributes, Auth.InvocationContext context) {
// Get the user's associated contact
User u = [SELECT Id, ContactId FROM User WHERE Id = :userId];
if(u.ContactId != null){
Contact c = [SELECT AccountId FROM Contact WHERE Id = :u.ContactId];
// Add the AccountId to your custom attributes map
formulaDefinedAttributes.put('organization_ids', c.AccountId);
}
@nhocki
nhocki / config.ini
Created September 4, 2022 02:15 — forked from orendon/config.ini
Visa appointment (renewal)
[USVISA]
; Account and current appointment info from https://ais.usvisa-info.com
USERNAME = YOUR_EMAIL
PASSWORD = YOUR_PASSWORD
SCHEDULE_ID = YOUR_ID
MY_SCHEDULE_DATE = YYYY-MM-DD
; Spanish - Colombia
COUNTRY_CODE = es-co
; Bogotá
FACILITY_ID = 26
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<Settings soundProfile="1" mode="TWS">

Title

Authors:

  • @githubusername

1 TL;DR

@nhocki
nhocki / autoscaler.rb
Last active January 13, 2022 02:14
Most naive worker autoscaler for Heroku.
class Autoscaler
def initialize(app_name:, token: ENV["AUTOSCALE_TOKEN"])
@client = PlatformAPI.connect_oauth(token)
@app_name = app_name
end
def run!
puts "[Autoscaler] We currently have #{current_number_of_workers} workers and #{number_of_queued_jobs} jobs queued."
if number_of_queued_jobs > 0 && current_number_of_workers < 1
pipeline {
agent {
label 'build_node'
}
stages {
stage('run services pipelines') {
steps {
script {
parallel buildServices()
package main
import (
"log"
"os"
"os/signal"
"syscall"
"time"
"foo/bar/splice/ratelimiter"
@nhocki
nhocki / multi-arch.sh
Last active April 3, 2018 14:05
Modified https://github.com/stickermule/rump to use KEYS against an older Redis installation.
#!/usr/bin/env bash
VERSION="$1"
rm rump-*
GOOS=darwin GOARCH=amd64 go build -o rump-$VERSION-darwin-amd64 rump.go
GOOS=linux GOARCH=amd64 go build -o rump-$VERSION-linux-amd64 rump.go
GOOS=linux GOARCH=arm go build -o rump-$VERSION-linux-arm rump.go
GOOS=windows GOARCH=amd64 go build -o rump-$VERSION-windows-amd64 rump.go
@nhocki
nhocki / main.go
Created October 18, 2017 09:02
UUID generation tool
package main
import (
"fmt"
"github.com/mattetti/uuid"
)
func main() {
fmt.Println(uuid.GenUUID())
@nhocki
nhocki / settings.json
Created May 10, 2017 00:01
vscode settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Inconsolata, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 16,
"editor.rulers": [ 80 ],
"editor.tabSize": 2,
"workbench.statusBar.visible": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.shell.osx": "/bin/zsh",
"go.gopath": "/Users/tarjan/go",