Skip to content

Instantly share code, notes, and snippets.

View sparse91's full-sized avatar
💭
FreePalestine!

sparse91

💭
FreePalestine!
View GitHub Profile
@sparse91
sparse91 / quota.sh
Created May 7, 2021 10:52
Gitlab Community Edition (CE) quota limit per project
#!/bin/bash -eu
###
### /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/quota.sh
### limit: 100MB
###
REPO_SIZE="$(du -s . | cut -f1)"
if (( "$REPO_SIZE" > 102400 ))
@sparse91
sparse91 / jail.local
Created July 31, 2019 12:37
Fail2Ban filter and jail for Kerberos (krb5-kdc)
[krb5kdc]
enabled = true
filter = krb5kdc
bantime = 86400
maxretry = 6
backend = systemd
banaction = iptables-allports
protocol = all
@sparse91
sparse91 / sadad-encryption.java
Created July 31, 2019 06:47
شیوه رمز کردن اطلاعات درگاه پرداخت بانکی سداد در جاوا - Sadad Payment Gateway encryption method In Java
private String signData(final String text) {
byte[] terminalKey = Base64.getDecoder().decode("__TERMINAL_KEY__"));
var secretKeySpec = new SecretKeySpec(terminalKey, "DESede");
try {
var cipher = Cipher.getInstance("DESede");
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
byte[] encryptedText = cipher.doFinal(text.getBytes());
var encryptedTextString = Base64.getEncoder().encodeToString(encryptedText);
return encryptedTextString;
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException |
@sparse91
sparse91 / kamailio.cfg
Last active February 11, 2024 16:34
Kamailio SIP proxy for freeswitch with RTPEngine for RTP traffic (Kamailio+SIP+RTP+Freeswitch)
#!KAMAILIO
#
# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
# - web: https://www.kamailio.org
# - git: https://github.com/kamailio/kamailio
#
# Direct your questions about this file to: <sr-users@lists.kamailio.org>
#
# Refer to the Core CookBook at https://www.kamailio.org/wiki/
# for an explanation of possible statements, functions and parameters.
@sparse91
sparse91 / jail.local
Created February 22, 2019 07:31
Fail2Ban filter for sslh demultiplexed ssh - Doesn't (and cannot) detect auth errors, but many connection attempts from the same origin is reason enough to block - Works on Arch Linux
[sslh-ssh]
enabled = true
filter = sslh-ssh
maxretry = 10
backend = systemd
bantime = 1w
action = firewallcmd-rich-rules[name=sslh,port="443"]