Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View flozano's full-sized avatar

Francisco A. Lozano flozano

  • Kii corporation
  • Valencia, Spain
View GitHub Profile
@flozano
flozano / quartz-snippets.md
Created April 27, 2023 09:33
Quartz snippets

Force execution

update QRTZ_TRIGGERS set next_fire_time = (select unix_timestamp(date_add(now(), interval 1 minute)) * 1000) where job_name = 'myJob';

Pause execution of a trigger

@flozano
flozano / defer-FKs-and-validations-when-using-seed-dumps.rb
Created December 5, 2022 18:57
[Defer all foreign keys and validations in RoR after dumping seed]
# Assuming 'base.rb' contains a seed dump (https://github.com/rroblak/seed_dump)
# Disable validations
ApplicationRecord.class_eval do
def valid?(a=1)
true
end
end
# Not sure if the transactional code is needed...
@flozano
flozano / MonBuffers.java
Created March 24, 2022 10:23 — forked from t3rmin4t0r/MonBuffers.java
Monitoring direct memory in the JVM (from https://blogs.oracle.com/alanb/entry/monitoring_direct_buffers, adapted for JDK8)
import java.io.File;
import java.util.*;
import java.lang.management.BufferPoolMXBean;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.*;
import com.sun.tools.attach.VirtualMachine; // Attach API
@flozano
flozano / notes
Last active November 21, 2021 11:57
[OpenID Connect notes]
https://auth0.com/blog/id-token-access-token-what-is-the-difference/
"One of the most common mistakes developers make with an ID token is using it to call an API."
But in ASP.NET:
https://docs.microsoft.com/es-es/dotnet/api/microsoft.extensions.dependencyinjection.jwtbearerextensions.addjwtbearer?view=aspnetcore-6.0
Enables JWT-bearer authentication using the default scheme AuthenticationScheme.
"JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header."
https://curity.io/resources/learn/jwt-best-practices/#1-jwts-used-as-access-tokens
@flozano
flozano / gpg-agent-setup.sh
Last active October 29, 2021 06:16
[Setup GPG agent]
eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info)
export GPG_TTY=$(tty)
export GPG_AGENT_INFO
@flozano
flozano / puppet-apply.sh
Created October 29, 2021 06:16
Apply puppet once
# noop
puppet agent --no-daemonize --verbose --onetime --pluginsync --test --noop
# real
puppet agent --no-daemonize --verbose --onetime --pluginsync --test
@flozano
flozano / eclipse-fix-codesign.sh
Created October 16, 2021 12:33
[Fix eclipse codesign] #shell #osx #eclipse
codesign --force --deep --sign - Eclipse.app
@flozano
flozano / GitHub protocol comparison.md
Created September 15, 2020 12:50
A comparison of protocols offered by GitHub (for #git on Freenode).

Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.

Protocols to choose from when cloning:

plain Git, aka git://github.com/

  • Does not add security beyond what Git itself provides. The server is not verified.

    If you clone a repository over git://, you should check if the latest commit's hash is correct.

@flozano
flozano / .gitconfig
Created September 15, 2020 12:49 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
@flozano
flozano / pdf-utils.sh
Last active March 16, 2020 16:44
pdf
#!/bin/bash
# Merge pages from a1 and a2 into b
qpdf --empty --pages a1.pdf 1-z a2.pdf 1-z -- b.pdf
# Merge pages from a* into b
qpdf --empty --pages $(for i in a*.pdf; do echo $i 1-z; done) -- b.pdf
# Remove password
qpdf -password=mypassword -decrypt source_with_password.pdf target_without_password.pdf