Skip to content

Instantly share code, notes, and snippets.

View dvcama's full-sized avatar

Diego Valerio Camarda dvcama

View GitHub Profile
@dvcama
dvcama / gist:031c4c32d8fa8481fd12
Last active January 21, 2016 11:17
virtuoso : export all graphs (triple dump) - virtuoso 7
CREATE PROCEDURE dump_nquads
( IN dir VARCHAR := 'dumps'
, IN start_from INT := 1
, IN file_length_limit INTEGER := 100000000
, IN comp INT := 1
)
{
DECLARE inx, ses_len INT
; DECLARE file_name VARCHAR
; DECLARE env, ses ANY
@dvcama
dvcama / gist:05309640e4f9e4a8b1ab
Created July 18, 2015 22:58
First 1000 lines of every file in a folder
#!/bin/bash
for file in *; do head -n 10000 "$file" > ../redux/"$file"; done
@dvcama
dvcama / gist:2821b9e36a198a542c0b
Created June 21, 2015 15:36
add temporary access to an IP on port 8890
sudo iptables -A INPUT -p tcp --dport 8890 -s XXX.XXX.XXX.XXX -j ACCEPT
@dvcama
dvcama / cvs.sh
Last active August 29, 2015 14:18
cvs: command line first commit
#!/bin/bash
find . -type d \! -name CVS -exec cvs add '{}' \;
find . \( -type d -name CVS -prune \) -o \( -type f -exec cvs add '{}' \; \)
find . \( -type d -name CVS -prune \) -o \( -type f -exec cvs commit -m "first version" '{}' \; \)
@dvcama
dvcama / load_graphs
Created January 9, 2015 14:11
virtuoso : load all graphs (triple dump)
CREATE PROCEDURE load_graphs
( IN dir VARCHAR := '{WRITE HERE YOUR EXPORT PATH (allowed dir in virtuoso.ini)}' )
{
DECLARE arr ANY;
DECLARE g VARCHAR;
arr := sys_dirlist (dir, 1);
log_enable (2, 1);
FOREACH (VARCHAR f IN arr) DO
{
@dvcama
dvcama / dump_graphs
Last active July 5, 2019 02:36
virtuoso : export all graphs (triple dump) - virtuoso 6
CREATE PROCEDURE dump_graphs
( IN dir VARCHAR := '{WRITE HERE YOUR EXPORT PATH (allowed dir in virtuoso.ini)}' ,
IN file_length_limit INTEGER := 10000000000
)
{
DECLARE inx INT;
inx := 1;
SET ISOLATION = 'uncommitted';
FOR ( SELECT *
FROM ( SPARQL DEFINE input:storage ""
@dvcama
dvcama / fromPdfToJpg
Created March 10, 2014 12:06
bash: extract high-res images from pdf using imagemagick (recursively)
#!/bin/bash
# extract jpg from PDF
# based on a script edited by Purch
#####################################
if [ -z $1 ];then echo Give target directory; exit 0;fi
find "$1" -depth -name '*.pdf' | while read file ; do
directory=$(dirname "$file")
oldfilename=$(basename "$file")