Skip to content

Instantly share code, notes, and snippets.

View dalegaspi's full-sized avatar
🎓
BU S2 2022

Dexter Legaspi dalegaspi

🎓
BU S2 2022
View GitHub Profile
@dalegaspi
dalegaspi / ConvertHttpMethodFilter.java
Created April 22, 2021 23:11
Custom Spring Cloud Gateway to change HTTP Method In Flight
package yeet;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
@dalegaspi
dalegaspi / brew_symlink_error_sierra.md
Last active January 4, 2024 22:32
Homebrew Symlink errors in Mac OSX High Sierra
@dalegaspi
dalegaspi / DynamicPostTransformFilter.java
Last active August 28, 2023 04:32
Spring Cloud Gateway Response Modification
package yeet;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.Strings;
import org.reactivestreams.Publisher;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.NettyWriteResponseFilter;
import org.springframework.cloud.gateway.filter.OrderedGatewayFilter;
import org.springframework.cloud.gateway.filter.factory.rewrite.CachedBodyOutputMessage;
import org.springframework.cloud.gateway.filter.factory.rewrite.MessageBodyDecoder;
@dalegaspi
dalegaspi / apple_tv_4k_settings.md
Last active December 30, 2022 20:27
Apple TV 4K Settings with an A/V Receiver

UPDATE December 2022

**Unless you have an older Apple TV 4K and/or a TV that's not manufactured from the last 5 years or so, do NOT follow the instructions below.

With the newer 4K TVs and especially paired with the newer generation of AppleTV, leave the Dolby Vision ON and leave Frame Rate Matching OFF or you will have audio sync issues. Newer TVs are already smart enough to detect frame rate so no need to do any of the instructions below.**

Prologue

The most prevalent issues as of this writing when using an Apple TV 4K with an A/V receiver:

@dalegaspi
dalegaspi / WireMockConfigurations.java
Last active December 29, 2022 19:51
WireMock with Maven, Reflection, and Clojure
package com.acme;
import clojure.java.api.Clojure;
import clojure.lang.IFn;
import clojure.lang.ISeq;
import clojure.lang.SeqIterator;
import io.vavr.control.Either;
import io.vavr.control.Try;
import lombok.extern.slf4j.Slf4j;
@dalegaspi
dalegaspi / AndroidManifest.xml
Last active July 16, 2022 12:39
Flickr OAuth 1.0a Authentication with Flickr4J and Scribe
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.bu.cs683.myflickr">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
@dalegaspi
dalegaspi / AppFx.java
Last active February 23, 2022 13:15
Creating a Splash Screen with JavaFx
package my.app;
import com.google.inject.Guice;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
@dalegaspi
dalegaspi / ftp.ps1
Last active January 7, 2022 03:11
FTP with PowerShell using built-in Windows FTP client
# as discussed here: http://stackoverflow.com/questions/1867385/upload-files-with-ftp-using-powershell
$server = "ftp.lolcats.com"
$filelist = "file1.txt file2.txt"
"open $server
user $user $password
binary
cd $dir
" +
@dalegaspi
dalegaspi / python27_on_centos65.md
Last active September 9, 2021 05:29
Installing Python 2.7 on CentOS 6.5

Installing Python 2.7 on Centos 6.5

Centos 6.* comes with Python 2.6, but we can't just replace it with v2.7 because it's used by the OS internally (apparently) so you will need to install v2.7 (or 3.x, for that matter) along with it. Fortunately, CentOS made this quite painless with their Software Collections Repository

sudo yum update # update yum
sudo yum install centos-release-scl # install SCL 
sudo yum install python27 # install Python 2.7

To use it, you essentially spawn another shell (or script) while enabling the newer version of Python:

@dalegaspi
dalegaspi / Readme.txt
Created May 19, 2015 20:48
Jersey 2.x Using Embedded Jetty with Swagger, CORS, and a ServletContextListener
the .java file is for initializing using embedded Jetty...the web.xml is for deploying the Jersey service as a WAR file.