Skip to content

Instantly share code, notes, and snippets.

View jachermocilla's full-sized avatar

Joseph Anthony C. Hermocilla jachermocilla

View GitHub Profile
@jachermocilla
jachermocilla / count_pubs.sh
Created March 9, 2020 02:08
Count the number of downloads of publications from nginx access logs
sudo zcat access.log.*.gz | grep /publications | grep pdf | awk '{print $7}' | sort | uniq -c | sort -nr
@jachermocilla
jachermocilla / getsample.sh
Last active September 19, 2019 08:07
Extract the malware sample from Virus Total Data that matches the given name only
#!/bin/bash
#filename is passed as command line argument
#file should contain the name of the malware
while IFS= read -r MALWARE; do
echo "Malware: $MALWARE"
mkdir $MALWARE
RESULT=`find . -type f -iname *.json -exec grep -l ".$MALWARE" {} \;`
#echo $RESULT
#!/bin/bash
# Default Variable Declarations
DEFAULT="inline_client.conf"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".key"
CA="ca.crt"
TA="ta.key"
/*
* This is an emailer appscript in google sheets to email students
* Sheet requirements:
* 1. First row should be headers (e.g. EXAM1, QUIZ, etc.)
* 2. Second row should be the total (e.g. 80, 100, etc.)
*/
//-------- Change the values of the variables below to customize --------
//The course
@jachermocilla
jachermocilla / rsa.c
Last active September 30, 2018 10:30
RSA
/*
An answer to Task3 by [email protected]
rsa.c
$gcc -o rsa.exe rsa.c -lcrypto
*http://www.cis.syr.edu/~wedu/seed/Labs_16.04/Crypto/Crypto_RSA/Crypto_RSA.pdf
*https://goo.gl/HuwEPn
*/
/*
* setuid example by [email protected]
*
* $gcc -o mysuid.exe mysuid.c
* $sudo chown root.root mysuid.exe
* $sudo chmod 4755 mysuid.exe
*
* Note: must be run in a filesystem mounted with no 'nosuid'
* ex: /tmp
*
@jachermocilla
jachermocilla / binding.c
Last active April 22, 2018 12:20
Address binding
/**
* [email protected]
*
* $ gcc -fno-common -c -o binding.o binding.c
* $ gcc -fno-commin -o binding.exe binding.c
*
*/
#include <stdio.h>
#include <stdlib.h>
@jachermocilla
jachermocilla / prodcon.c
Last active January 5, 2023 17:42
Producer-Consumer Problem Solutions (compile with -lpthread)
#define _GNU_SOURCE //to be able to use pthread_setname_np()
//implementation of solution to prod-con from chapter 3, dino book
//not all slots are used
//-jach
//
#include <stdio.h>
#include <pthread.h>
#!/bin/bash
#[email protected]
#run as root in BACKUP_DB_PATH
MYSQL_USER=root
MYSQL_PASSWORD=joseph
MYSQL_HOST=127.0.0.1
MYSQL_DATA_PATH=/var/lib/mysql
TARGET_PORT=9999
THIS_USER=root
#!/bin/bash
#by [email protected]
#
# This script recrawls the sites indicated in URLS_DIR and
# forwards results to Solr.
# This script deletes everyting in Nutch and Solr.
#
JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
NUTCH_HOME=/home/ubuntu/apache-nutch-1.11