Skip to content

Instantly share code, notes, and snippets.

View trajano's full-sized avatar
🖖
https://t.me/s/tracer_needs_a_buff

Archimedes Trajano trajano

🖖
https://t.me/s/tracer_needs_a_buff
View GitHub Profile
@trajano
trajano / settings.json
Last active May 31, 2023 16:51
Windows Terminal (with git bash and additional shortcuts)
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{00000000-0000-0000-ba54-000000000002}",
"launchMode": "maximized",
"theme": "light",
"useTabSwitcher": false,
"tabWidthMode": "titleLength",
"profiles": {
@trajano
trajano / proxy.yml
Created March 21, 2019 20:59
traefik compose file
version: "3.7"
services:
traefik:
image: traefik:v1.7.9-alpine
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
@trajano
trajano / .bashrc
Last active October 11, 2019 20:01
Bash RC
dsreload() {
IMAGE=$(docker service inspect -f "{{.Spec.TaskTemplate.ContainerSpec.Image}}" $1 | cut -f1 -d"@")
docker service update --force --image $IMAGE $1
}
cd() {
if [ $# -eq 0 ]
then
builtin pushd ${HOME} > /dev/null
else
builtin pushd "$1" >& /dev/null || builtin cd "$1"
@trajano
trajano / FileSchemeGlobalFilter.java
Last active February 11, 2019 15:33
Add file/classpath support in Spring Cloud Gateway
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
@trajano
trajano / DockerSwarmDiscoveryClient.java
Last active February 9, 2019 19:30
Docker Swarm Discovery Client
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.annotation.Order;
import org.springframework.http.MediaType;
@trajano
trajano / main.cpp
Last active January 13, 2019 19:09
C++ Singleton
#include <iostream>
#include "singleton.h"
int main()
{
std::cout << "Hello World!" << std::endl;
std::cout << Singleton::instance().singletonMethod() << std::endl;
}
@trajano
trajano / HtmlToPdf.java
Last active November 21, 2018 14:01
PDFBOX-3903
import com.openhtmltopdf.DOMBuilder;
import com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder;
import com.openhtmltopdf.pdfboxout.PdfRendererBuilder;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@trajano
trajano / trajano.json
Last active October 25, 2018 05:03
Karabiner Personal Rules
{
"title": "Personal Rules (@trajano)",
"author": "Archimedes Trajano",
"rules": [
{
"description": "Fn+Shift+Esc Opens Activity Monitor",
"manipulators": [
{
"type": "basic",
"from": {
@trajano
trajano / keybindings.json
Created April 28, 2017 14:54
Archie's Visual Studio Code Settings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+f",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+f",
"command": "-editor.action.formatDocument",
@trajano
trajano / preload-double-download.html
Last active April 4, 2017 21:25
This will cause a double download of JQuery in Chrome
<html>
<head>
<link rel="preload" href="//code.jquery.com/jquery-2.2.4.min.js" as="script" crossorigin />
</head>
<body>
Load me up in <a href="http://rawgit.com/trajano/a61654502d4aa6191d742766f87dc5fe/raw/4aaa942f8457513d60fd1a26d953fd847b2aaea2/preload-double-download.html">Rawgit</a> don't forget to enable developer console to see the warnings.
<script src="//code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
</body>