Skip to content

Instantly share code, notes, and snippets.

Avatar

Renny Koshy rkoshy

View GitHub Profile
@rkoshy
rkoshy / gist:af8b53b8738be955e8238d78511d36f3
Created Jul 8, 2022
Excluding crypto artifacts during the maven "shade" creation of an uber-jar
View gist:af8b53b8738be955e8238d78511d36f3
@rkoshy
rkoshy / gist:0b8c42b2f9f8a5ce21178fc61aabc378
Last active Jul 8, 2022
Get a list of signed jar referenced by a maven project (pom.xml)
View gist:0b8c42b2f9f8a5ce21178fc61aabc378

From SO link: https://stackoverflow.com/a/54111506 (Rostislav Matl)

#!/bin/bash
mvn_classpath=`mvn dependency:build-classpath -B | awk '/Dependencies classpath:/{getline; print}' | sed -e s/:/\\\\n/g`

for jar in $mvn_classpath; do 
        echo -n `jarsigner -verify $jar | grep verified | wc -l`; echo " $jar"; 
done
View EndPointDetection.java
package org.ioe.tprsa.audio.preProcessings;
/**
* @author Ganesh Tiwari
* @reference 'A New Silence Removal and Endpoint Detection Algorithm
* for Speech and Speaker Recognition Applications' by IIT, Khragpur
*/
public class EndPointDetection {
private float[] originalSignal; //input
private float[] silenceRemovedSignal;//output
private int samplingRate;
@rkoshy
rkoshy / gist:e4545e379be13b1382a68ff54a5cd282
Created Mar 11, 2019
Rebuilding software RAID without mdadm.conf
View gist:e4545e379be13b1382a68ff54a5cd282
**
SOURCE: https://www.tekovic.com/rebuilding-software-raid-without-mdadmconf
by Sasa Tekovic on 1. September 2015 - 19:55
**
Austing PowersRebuilding software RAID array is very easy when you have your mdadm.conf file at hand, but when you find yourself in a situation without backup of that little config file, e.g. after reinstalling the system or when your migrate disks to the new server, it can be a bit daunting.
Recently I had to reassemble two software RAID1 arrays one small Debian server after OS reinstall. So, there were four hard drives in total and to avoid mix-up and data loss, I had to find out which disk belonged which RAID array. Examining each drive with mdamd provided me with the necessary information.
root@localhost:~# mdadm --examine /dev/sdd1
@rkoshy
rkoshy / gist:db25460c82626da240a64540287e6ed8
Created Mar 8, 2019 — forked from krisnod/gist:56ff894f400cce7c742fb11fb2fde9cf
RancherOS on Hetzner using software RAID (RAID 1)
View gist:db25460c82626da240a64540287e6ed8
Install:
----------
* Activate Hetzner Rescue System (Debian)
* Connect to Hetzner Rescue System using SSH and live boot RancherOS
(thanks goes to William Fleurant for showing how this can be done: https://github.com/wfleurant/boot-rancheros-hetzner/)
* apt-get update
* apt-get install kexec-tools aria2
@rkoshy
rkoshy / reset_vti.sh
Last active Jun 12, 2022
Script to reset VyOS VTI interfaces that are stuck in "Administrative Down".
View reset_vti.sh
#!/bin/bash
RUN=/opt/vyatta/bin/vyatta-op-cmd-wrapper
DOWN=`$RUN sh interfaces |grep "A/D"|awk '{print $1}'`
echo Interfaces that need resetting: $DOWN
for TUN in $DOWN
do
PEER=`$RUN sh interfaces vti $TUN |grep peer|sed -e"s/.* peer \([0-9\.]*\)/\1/"`
logger -t "reset_vti.sh" "Resetting $TUN with peer IP $PEER"
$RUN reset vpn ipsec-peer $PEER
done