Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

2020/07/02

Automatic backups in Windows

The following powershell script copies all .docx files from $global:SRC to $global:DEST with a timestamp.

Save this file to something like "StartClone.ps1". Then launch it with "[right click] > Run with PowerShell." Minimize the resulting window.

### Configuration - CUSTOMIZE THESE
$global:SRC = "C:\Users\fil\test"
$global:DEST = "C:\Users\fil\backup"
$global:LOGFILE = "C:\Users\fil\log.txt"


### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $global:SRC
$watcher.Filter = "*.docx"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true  

$rv=Test-Path "$global:DEST"
if ($rv -eq $False) {
    New-Item -ItemType "directory" -Path "$global:DEST"
}

function global:logging ($text) {
    $logline = "$(Get-Date -uformat "%Y/%m/%d %H:%M:%S") - $text"
    Add-content $global:LOGFILE -value $logline
}

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { 
    $path = $Event.SourceEventArgs.FullPath
    $changeType = $Event.SourceEventArgs.ChangeType
    global:logging "$changeType $path"    
    $file = Split-Path $path -leaf
    $now = "$(Get-Date -uformat "%Y-%m-%d %H.%M.%S")"
    $dest = "$global:DEST\$now $file"
    # global:logging "file=$file now=$now dest=$dest"
    copy-item "$path" "$dest"
}    
### DECIDE WHICH EVENTS SHOULD BE WATCHED 
echo "Hello world $global:LOGFILE"
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
# Register-ObjectEvent $watcher "Deleted" -Action $action
# Register-ObjectEvent $watcher "Renamed" -Action $action
global:logging Started
while ($true) {sleep 60}

2020/03/30

Windows 10 vs Lexmark

So I have a new Lexmark MB2236adw laser printer. For some reason beyond my ken, Windows 10 keeps saying it's offline, when clearly it isn't. Printer works fine from Linux, so I decided that Windows is going to print via CUPS.

First, create a raw printer on your CUPS host:

lpadmin -p hwelraw -v socket://hwel.localdomain:9100 -E \
     -D "Lexmark on UPS (raw)" -L "Philip's Office" -o raw

Then add the following to cups.conf to allow printing via the network:

<Location /printers>
    Order allow,deny
    Allow localhost
    Allow 10.0.0.*
</Location>

Remember to restart CUPS

service cups reload

Open up the port 631 in iptables.

Now on the windows computer, install the Lexmark drivers.

Then you have to turn on IPP : Control Panel > Programs > Turn Windows Features On or Off > Print and Document Services > Internet Printing Client must be checked.

Now it's time to Add a printer, using the The printer that I want isn’t listed button. You are going to be using an http URL, that will look like http://scott/pritners/hwelraw. Replace scott with your Linux computer's name and hwelraw with the CUPS queue name. Select the printer driver installed previously, print your test page and bask in the glory of getting a computer to do your bidding.

As a bonus step, print a 2 page document to make sure Windows can print double sided because my new printer does cool things like that.

2011/06/27

Phishing

I just got called by someone from "Global Security Services." He had a very pleasant South Asian accent. He started with "I assume you are running the Microsoft Windows operating system." To which I answered "Of course not!" He quickly hung up.

Now, I'm going to be highly suspicious of anyone calling me long distance without caller ID info. The "Global Security mutter mutter" made me highly suspicious that this was part of a new phishing scam that's been going on. The goal is to have you install some "Microsoft Security product" which is of course malware.

Notice to readers and family members: They are calling people in Canada. Never ever install anything a cold-caller says to. Ideally stop using Windows at all. It's security is atrocious and the knowledge required to keep it secured is beyond most normal users.

2011/02/20

Nice one, Microsoft

For the last 2 weeks or so, I've been staring at and thinking about the UI to my new startup's flagship product. Beyond the Beyond pointed me towards a piece by the Windows Phone 7 metro design language. So I Googled up some examples. And I find this really beautiful website.

Now, if there's something I enjoy more then complaining about computers, it's complaining about Microsoft. Not only that, I've been staring at websites for the last +16 years. Rarely has a website design made me go "woah, yes!" Black/white/grey/orange? Liberal use of whitespace? Visible clutter approaching zero? WOAH! YES!

What's more, the videos of the Metro design language I've seen make it look really nice. I would call it what happens when you mix Helvetica, iOS and the minimalism of the 1972 Munich Olympic pictograms.

PS: I was going to post a link to Apple's iOS 4 page, but I had to spend a few minutes refusing all the cookies they wanted to set. Fuck 'em.