Skip to content

Instantly share code, notes, and snippets.

View M4NN3's full-sized avatar
🎯
Focusing

Manne Rodríguez M4NN3

🎯
Focusing
View GitHub Profile
@M4NN3
M4NN3 / factura.json
Created February 16, 2024 17:37
JSON data to sent to Runfact
{
"infoTributaria": {
"ambiente": 1,
"tipoEmision": 1,
"razonSocial": "PRUEBAS SERVICIO DE RENTAS INTERNAS",
"nombreComercial": "PRUEBAS SERVICIO DE RENTAS INTERNAS",
"ruc": "0000000000001",
"codDoc": "01",
"estab": "001",
"ptoEmi": "001",
@M4NN3
M4NN3 / gist:ab912fd363be1574d62338e7834903a3
Created October 14, 2022 14:37
FFmepg Decode 7.1 to 5.1
ffmpeg -i a.eac3 a1.ac3
@M4NN3
M4NN3 / CodigoControlModulo11.java
Created September 3, 2022 02:46
El método denominado módulo 11 detecta errores en un solo dígito e intercambios simples o dobles. Se basa en aplicar un factor de chequeo ponderado a cada dígito del número original
private static int mod11(){
String key = "41261533";
int sum = 0, factor = 2, dv, keyL = key.length();
for (int i = 0; i < keyL; i++) {
sum+=(key.charAt((keyL-1)-i) - '0') * factor;
factor = factor == 7 ? 2 : factor+1;
}
dv = 11 - (sum % 11);
if (dv < 10)
return dv;
@M4NN3
M4NN3 / EncryptDecrypt.java
Created July 15, 2022 15:44
Encrypt/Decrypt Text with Jasypt
public static String encryptText(String text)
{
AES256TextEncryptor aesEncryptor = new AES256TextEncryptor();
aesEncryptor.setPassword(LabelUtils.MASTER_PASSWORD);
return aesEncryptor.encrypt(text);
}
public static String decrptText(String textEncrypted)
{
try {
AES256TextEncryptor aesEncryptor = new AES256TextEncryptor();
@M4NN3
M4NN3 / FirebaseRepository.java
Created May 18, 2022 18:49
Inicar instancia de Firebase/Firestore en java web o desktop
public class FirebaseRepository implements Serializable {
private static Firestore db;
private static synchronized void buildConnection() throws IOException {
ClassPathResource resJson = new ClassPathResource("META-INF/file.json");
GoogleCredentials credentials = GoogleCredentials.fromStream(resJson.getInputStream());
FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(credentials)
.build();
FirebaseApp.initializeApp(options);
@M4NN3
M4NN3 / JavaFX drag window.java
Created March 18, 2022 19:03
JavaFX no border window drag
private double xOffset = 0;
private double yOffset = 0;
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("ui/dashboard.fxml"));
root.getStylesheets().add(getClass().getResource("styles.css").toString());
primaryStage.setTitle(LabelUtils.APP_NAME);
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);