Skip to content

Instantly share code, notes, and snippets.

View ianfhunter's full-sized avatar
🐶
Woof Woof!

Ian Hunter ianfhunter

🐶
Woof Woof!
View GitHub Profile
@ianfhunter
ianfhunter / nolock.ps1
Created March 21, 2017 10:06
Press . to stop screen locking
param($minutes = 240)
$myshell = New-Object -com "Wscript.shell"
for($i=0;$i-lt $minutes;$i++){
Start-Sleep -Seconds 60
$myshell.sendkeys(".")
}
@ianfhunter
ianfhunter / ImageNumpy.py
Last active May 25, 2017 13:34
Quickly Print an Image Range and save to a npy file
from PIL import Image # The Python Imaging Library
import numpy #
a = "/home/ian/testimages/" #
img = Image.open(a+"cat.png") # Open Image Data
numpy_data = numpy.asarray(img) # Convert to NPY
print(numpy_data) #
numpy.save("../data/cat.npy", numpy_data) # Save To File (Contains information about datatypes, shapes, etc. Use load to read)
numpy_data.tofile("../data/cat.npy") # Save To File (Pure Binary Data. Use fromfile to read)

Keybase proof

I hereby claim:

  • I am ianfhunter on github.
  • I am ianfhunter (https://keybase.io/ianfhunter) on keybase.
  • I have a public key whose fingerprint is 4732 61A5 1858 A2C2 C9D1 FFD5 5AB5 5AF2 79F8 619C

To claim this, I am signing this object:

@ianfhunter
ianfhunter / Longest Anime Title
Last active August 29, 2015 14:03
Longest Anime Title
import re
# To be used with anime-titles.dat from AniDB, replace with your own path
# created: Thu Jul 10 02:00:05 2014
# <aid>|<type>|<language>|<title>
# type: 1=primary title (one per anime), 2=synonyms (multiple per anime), 3=shorttitles (multiple per anime), 4=official title (one per language)
def is_ascii(s):
return all(ord(c) < 128 for c in s)