Skip to content

Instantly share code, notes, and snippets.

View TwiN's full-sized avatar
Extremely busy

TwiN

Extremely busy
View GitHub Profile
@TwiN
TwiN / ExampleController.java
Created April 16, 2018 01:06
Spring Security with inMemoryAuthentication + passwordEncoder
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ExampleController {
@GetMapping("/")
@TwiN
TwiN / SecurityConfiguration.java
Last active May 14, 2018 18:53
SecurityConfiguration that prevents authenticated user from accessing the /login page
package org.twinnation.stackoverflowspring.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@TwiN
TwiN / color.go
Last active January 9, 2019 01:04
Colors in Go
package color
import "runtime"
var Reset = "\033[0m"
var Red = "\033[31m"
var Green = "\033[32m"
var Yellow = "\033[33m"
var Blue = "\033[34m"
var Purple = "\033[35m"
@TwiN
TwiN / test-passed-pika
Created February 20, 2019 16:30
test-passed-pika
,@@@@@@@@@@,,@@@@@@@% .#&@@@&&.,@@@@@@@@@@, %@@@@@@%* ,@@@% .#&@@@&&. *&@@@@&( ,@@@@@@@% %@@@@@, ,@@,
,@@, ,@@, ,@@/ ./. ,@@, %@% ,&@# .&@&@@( .@@/ ./. #@&. .,/ ,@@, %@% *&@&. ,@@,
,@@, ,@@&%%%%. .&@@/, ,@@, %@% ,&@# %@& /@@, .&@@/, (@@&%(*. ,@@&%%%%. %@% &@# ,@@,
,@@, ,@@/,,,, ./#&@@@( ,@@, %@@@@@@%* /@@, #@&. ./#&@@@( *(%&@@&. ,@@/,,,, %@% &@# .&&.
,@@, ,@@, ./, .&@# ,@@, %@% ,@@@@@@@@@% ./. .&@# /*. /@@. ,@@, %@% *&@&. ,,
,@@, ,@@@@@@@% .#&@@@@&/ ,@@, %@% .&@# ,@@/.#&@@@@&/ /%&@@@@. ,@@@@@@@% %@@@@@. ,@@,
,*************,,*/(((((//,,*(#%%%%%%%%%%%%%%%#(*,,,****************************************************,*/(((((((((/((((////****/((##%%%%%%
,*************,,//((((((//,,*(%%%%%%%%%%%%%%%%%##/
@TwiN
TwiN / build.sh
Created April 29, 2019 12:24
Multi-platform bash script to build Go binaries
#!/bin/bash
APPLICATION_NAME="appname"
env GOOS=darwin GOARCH=amd64 go build -o bin/darwin/${APPLICATION_NAME}-darwin64
env GOOS=linux GOARCH=amd64 go build -o bin/linux/${APPLICATION_NAME}-linux64
env GOOS=windows GOARCH=amd64 go build -o bin/windows/${APPLICATION_NAME}-windows64.exe
chmod +x bin/darwin/${APPLICATION_NAME}-darwin64
chmod +x bin/linux/${APPLICATION_NAME}-linux64
apiVersion: sqs.aws.crossplane.io/v1beta1
kind: Queue
metadata:
name: {{ .Release.Name }}
spec:
deletionPolicy: Delete
forProvider:
region: {{ .Values.awsRegion }}
delaySeconds: 1
messageRetentionPeriod: 604800
@TwiN
TwiN / gist:f17aa13ed36a1d953809f756599129cd
Created May 15, 2022 02:56
GitHub action to close stale issues and pull requests
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4