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 / 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
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 / 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
@TwiN
TwiN / test-passed-pika
Created February 20, 2019 16:30
test-passed-pika
,@@@@@@@@@@,,@@@@@@@% .#&@@@&&.,@@@@@@@@@@, %@@@@@@%* ,@@@% .#&@@@&&. *&@@@@&( ,@@@@@@@% %@@@@@, ,@@,
,@@, ,@@, ,@@/ ./. ,@@, %@% ,&@# .&@&@@( .@@/ ./. #@&. .,/ ,@@, %@% *&@&. ,@@,
,@@, ,@@&%%%%. .&@@/, ,@@, %@% ,&@# %@& /@@, .&@@/, (@@&%(*. ,@@&%%%%. %@% &@# ,@@,
,@@, ,@@/,,,, ./#&@@@( ,@@, %@@@@@@%* /@@, #@&. ./#&@@@( *(%&@@&. ,@@/,,,, %@% &@# .&&.
,@@, ,@@, ./, .&@# ,@@, %@% ,@@@@@@@@@% ./. .&@# /*. /@@. ,@@, %@% *&@&. ,,
,@@, ,@@@@@@@% .#&@@@@&/ ,@@, %@% .&@# ,@@/.#&@@@@&/ /%&@@@@. ,@@@@@@@% %@@@@@. ,@@,
,*************,,*/(((((//,,*(#%%%%%%%%%%%%%%%#(*,,,****************************************************,*/(((((((((/((((////****/((##%%%%%%
,*************,,//((((((//,,*(%%%%%%%%%%%%%%%%%##/
@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 / 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 / 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 / package.json
Created December 19, 2017 21:04
My webpack configuration (+ package.json)
{
"name": "twinnation",
"author": "TwiN",
"description": "TwiNNatioN",
"version": "0.7.5",
"license": "MIT",
"main": "src/App.js",
"scripts": {
"start-webpack": "webpack-dev-server --port 80 --hot --progress --colors",
"build-webpack": "webpack --config webpack.config.js -p",
@TwiN
TwiN / WebConfiguration.java
Created December 17, 2017 21:51
Link a React app using React-Router and bundled with Webpack to a Spring Boot app
package org.twinnation.site;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebConfiguration {
@TwiN
TwiN / ActivityEventListener.md
Created October 24, 2017 14:48 — forked from blackcj/ActivityEventListener.md
Demonstrates how to call a function in the parent Activity from within a Fragment.

Step 1: Add any functions you want to call into the interface (EventListener).

Step 2: Implement those functions in your MainActivity.

Step 3: Create the listener in your Fragment and attach it to the Activity.

Step 4: Call any functions on the listener.