Skip to content

Instantly share code, notes, and snippets.

View gsdefender's full-sized avatar
💭
I may be slow to respond.

Emanuele Cipolla gsdefender

💭
I may be slow to respond.
View GitHub Profile
@gsdefender
gsdefender / pacchetti-cygwin.txt
Created July 4, 2015 13:25
Pacchetti Cygwin - Guida HTTP/2
_autorebase,_update-info-dir,adwaita-icon-theme,alternatives,at-spi2-core,autoconf,autoconf2.1,autoconf2.5,automake,automake1.10,automake1.11,automake1.12,automake1.13,automake1.14,automake1.15,automake1.4,automake1.5,automake1.6,automake1.7,automake1.8,automake1.9,base-cygwin,base-files,bash,bash-completion,binutils,bzip2,ca-certificates,cmake,cmake-doc,cmake-gui,compositeproto,coreutils,crypt,csih,cygrunsrv,cygutils,cygwin,cygwin-debuginfo,cygwin-devel,cygwin64-expat,cygwin64-pkg-config,cygwin64-pkg-config-debuginfo,damageproto,dash,dbus,dconf-service,desktop-file-utils,diffutils,dri-drivers,editrights,expat,expat-debuginfo,file,findutils,fixesproto,gamin,gawk,gcc-core,gcc-g++,gccmakedep,gcr,gdb,gdk-pixbuf2.0-svg,getent,gettext,gettext-devel,girepository-Atk1.0,girepository-cairo1.0,girepository-Clutter1.0,girepository-Cogl1.0,girepository-GdkPixbuf2.0,girepository-GLib2.0,girepository-Gst1.0,girepository-Gtk2.0,girepository-Gtk3.0,girepository-GtkClutter1.0,girepository-Json1.0,girepository-Pango1.0,girepo
@gsdefender
gsdefender / java-properties.php
Created October 27, 2015 15:02 — forked from alecgorge/java-properties.php
Parse Java properties files in PHP
<?php
function parse_properties($txtProperties) {
$result = array();
$lines = split("\n", $txtProperties);
$key = "";
$isWaitingOtherLine = false;
foreach ($lines as $i => $line) {
if (empty($line) || (!$isWaitingOtherLine && strpos($line, "#") === 0))
continue;
@gsdefender
gsdefender / fuck-openldap.sh
Created August 23, 2016 15:56 — forked from jaseg/README.md
Convert openldap .schema files to .ldif files
#!/usr/bin/env bash
# convert OpenLDAP schema file to LDIF file
#
# Copyright 2012 NDE Netzdesign und -entwicklung AG, Hamburg
# Written by Jens-U. Mozdzen <jmozdzen@nde.ag>
# Copyright 2014 jaseg <github@jaseg.net>
#
# Permission is granted to use, modify and redistribute this file as long as
# - this copyright notice is left unmodified and included in the final code
@gsdefender
gsdefender / stop_words.php
Last active September 28, 2016 13:00 — forked from brianteachman/stop_words.php
A function that returns a PHP array of common English and Italian stop words.
<?php
//http://www.ranks.nl/stopwords/(language)
function stop_words($lang)
{
$stop_words = array("it_IT" => array("a",
"adesso",
"ai",
"al",
"alla",
"allo",
@gsdefender
gsdefender / mc.ext
Last active April 10, 2017 15:27
View xlsx file with Midnight Commander
# Add this to your mc.ext user file, search for
# Microsoft Excel Worksheet and _prepend_ this rule to the existing one.
regex/i/\.xlsx$
Open=/usr/lib/mc/ext.d/doc.sh open msxls
View=%view{ascii} /usr/local/bin/xlsx2csv %f
# Please note that if you do not prepend this block to the existing block for xls/xlsw, its regexp
# will catch the xlsx and so xlsx2csv will not be called
# Be sure to keep the existing viewer directives, as in this example:
# Microsoft Excel Worksheet
@gsdefender
gsdefender / image.py
Created June 5, 2017 12:53
Backport of image module from current Keras for use with older releases; includes a ImageDataGenerator that can be used with autoencoders
"""Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import re
from scipy import linalg
@gsdefender
gsdefender / compress_pdf
Created June 22, 2017 17:37
A way to reduce the size of PDF sizes
#!/usr/bin/env bash
# $3 must be one of: screen, ebook, printer, prepress, from lower to higher quality
# h/t: https://www.techwalla.com/articles/reduce-pdf-file-size-linux
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="/$3" -sOutputFile="$2" "$1"
@gsdefender
gsdefender / QCacheGrind-install.sh
Last active November 4, 2018 21:31 — forked from RichVRed/install.sh
Install QCacheGrind on Ubuntu
#!/bin/bash
# Build against Qt 4
sudo apt-get install qt4-default
# Build against Qt 5
#sudo apt-get install qt5-default
wget http://kcachegrind.sourceforge.net/kcachegrind-0.7.4.tar.gz
tar xvf kcachegrind-0.7.4.tar.gz
cd kcachegrind-0.7.4
# If building against Qt 5, uncomment lines 12-16:
@gsdefender
gsdefender / blocklist2dnsmasq.py
Last active August 25, 2020 10:58
Create dnsmasq blocklist configuration file out of a hosts file
#!/usr/bin/env python
# For blocklists see https://github.com/blocklistproject/lists/wiki/
import sys
with open(sys.argv[1], 'r') as blocklist_hosts_file, open(sys.argv[2], 'w+') as blocklist_dnsmasq_file:
for line in blocklist_hosts_file:
if not line.startswith('#'):
line = line.strip()
Search for : (.*(\n|$)){2}
alt+R - to toggle regular expression search
alt+ENTER - to select all results