Skip to content

Instantly share code, notes, and snippets.

@mraspor
mraspor / ddrescue.md
Created August 20, 2021 10:15 — forked from cetinajero/ddrescue.md
Guide to Using DDRescue to Recover Data

Guide to Using DDRescue to Recover Data

Start command:

ddrescue -d /dev/sda output.img output.mapfile

NOTE: If direct disc access is not available in your system, try raw devices.

@mraspor
mraspor / blocked_ips.sh
Last active February 1, 2019 19:48
APF firewall import blocked IPs from maxmind geoip database
#!/bin/bash
#
# URL of the Maxmind geoip database
#
filename="GeoLite2-Country-CSV"
filesuffix=".zip"
url="https://geolite.maxmind.com/download/geoip/database/$filename$filesuffix"
#
# Countries to block
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@mraspor
mraspor / services.php
Created October 8, 2014 18:26
Enable translation service in PhalconPHP. Use it as $this->translation or $this->getDI()->get('translation')
/**
* Translation service
*
* @return array
*/
$di->set('translation', function () use ($di) {
$request = $di->get('request');
$session = $di->get('session');
@mraspor
mraspor / Message.php
Created October 8, 2014 18:12
Modified Message class extends from Phalcon\Validation\Message to enable translation.Translation service needs to be set in DI. Don't forget to add correct namespace to your $loader.
<?php
namespace Library\Validation;
use Phalcon\DI;
/**
* Class Message
*