Skip to content

Instantly share code, notes, and snippets.

@pcg92
pcg92 / nif_validator.dart
Last active February 21, 2019 12:30
Validador DNI en dart / NIF validator dart
bool validateNIF(String value){
var validChars = 'TRWAGMYFPDXBNJZSQVHLCKET';
RegExp nifRegex = new RegExp(r'^[0-9]{8}[TRWAGMYFPDXBNJZSQVHLCKET]$');
var str = value.toString().toUpperCase();
if (!nifRegex.hasMatch(str)) return false;
String nie = str
.replaceAll(new RegExp(r"/^[X]/"), '0')
@pcg92
pcg92 / gist:27ab6482a116dbd56494453c2ddaceea
Last active January 11, 2022 15:52
Full backup ubuntu
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
https://ubuntuforums.org/showthread.php?t=35087
restore:
tar xvpfz backup.tgz -C /
private void getPlaces(){
mDataManager.getPlaces()
.flatMapIterable(placesDtos -> placesDtos)
.map(Place::mapper)
.toList()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(places -> {
getMvpView().setPlaces(places);
3 3 * * * mongodump --out /var/backups/mongobackups/`date +"\%m-\%d-\%y"`;python /home/user/gcloud/gdcp upload -p folderId /var/backups/mongobackups/`date +"\%m-\%d-\%y"`;
3 1 * * * find /var/backups/mongobackups/ -mtime +7 -exec rm -rf {} \;