Skip to content

Instantly share code, notes, and snippets.

@faisalraja
faisalraja / preferences.dart
Created January 17, 2019 03:03
SharedPreference helper for flutter
class Preference {
static SharedPreferences _prefs;
static Map<String, dynamic> _memoryPrefs = Map<String, dynamic>();
static Future<SharedPreferences> load() async {
if (_prefs == null) {
_prefs = await SharedPreferences.getInstance();
}
return _prefs;
}
@faisalraja
faisalraja / backup.py
Created October 1, 2014 21:07
Python Differential Backup Script for Immutable Files
import os
import shutil
__author__ = 'faisal'
backup_folders = [
# folders to backup, backup location, ignore top level directories
('D:\\', 'H:\\Drive_D\\', ['_temp', 'Downloads', '$RECYCLE.BIN']),
('E:\\', 'H:\\Drive_E\\', ['$RECYCLE.BIN'])
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@faisalraja
faisalraja / remote_api_script.py
Created August 1, 2013 22:57
Modified version of remote_api_shell.py that accepts a -r or --run your_python_file.py and --email --password to quickly run your app engine python scripts without interactivity.
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#