Skip to content

Instantly share code, notes, and snippets.

View fwarren's full-sized avatar

Fred Warren fwarren

View GitHub Profile
@fwarren
fwarren / fb_inventory.html
Last active July 13, 2017 17:14
Fishbowl Inventory Client for ie6 mobile
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="jquery-1.12.4.min.js"></script>
<!--[if lt IE 9]>
<script src="html5shiv.min.js"></script>
<script src="respond.min.js"></script>
@fwarren
fwarren / employee_birthday.sql
Last active August 22, 2017 21:16
List Employee Birthdays and Anniversaries.
SELECT e.LastName, e.FirstName,
CASE WHEN c.EmpGCstF1 = 1 THEN 0 ELSE 1 END AS 'Birthday', e.BirthDate,
CASE WHEN c.EmpGCstF2 = 1 THEN 0 ELSE 1 END AS 'Anniversary', e.HireDate
FROM Employee e
LEFT JOIN EmpCstFV c ON e.EmpUID = c.EmpUID AND c.CstID = 105
WHERE e.CompanyID = 6
AND e.TermDate IS NULL
ORDER BY e.LastName, e.FirstName
@fwarren
fwarren / imreceived.py
Last active August 25, 2017 23:49
Python Finch dbus message notifier
#!/usr/bin/python2
#
# simple d-busified evolution mail notifier
#
# notifies you about incoming mail with a sound and
# displays a tray icon in the notification area until
# you read some message in evolution again
#
# Thomas Perl <[email protected]> 2007-03-28
#
@fwarren
fwarren / file_dir_hash.php
Created September 2, 2017 02:26
File Hash to multiple Subdirectoris
<?php
// https://stackoverflow.com/questions/23787785/how-to-use-hash-function-for-storing-4-million-images-in-file-system
// $id = A unique identifier (a filename)
// It could be useful to make this id the same for the original,
// as well as any thumbnails. Your image and variants will all
// then end up in the same directory.
// $levels_deep = The number of directories deep you want to go.
// Want more levels? Use a hashing method with a longer
@fwarren
fwarren / filewalker.py
Last active October 5, 2017 23:29
Find all files in filetree that have null signatures
#!/usr/bin/python2
# Import the os module, for the os.walk function
import os
# Set the directory you want to start from
rootDir = '/cygdrive/d/Tank/Shares'
for dirName, subdirList, fileList in os.walk(rootDir):
for fname in fileList:
@fwarren
fwarren / imreceived.py
Created June 4, 2020 17:02
Python 2 dbus pidgin IM indicator
#!/usr/bin/python2
#
# simple d-busified evolution mail notifier
#
# notifies you about incoming mail with a sound and
# displays a tray icon in the notification area until
# you read some message in evolution again
#
# Thomas Perl <[email protected]> 2007-03-28
#
@fwarren
fwarren / sql.py
Last active February 2, 2021 19:13
employee_ids = [7, 25, 35, 18]
date_start = datetime.strptime('2021-01-15', '%Y-%m-%d')
date_finish = datetime.strptime('2021-01-31', '%Y-%m-%d')
def get_job_time_punches(cursor, employee_ids, date_start, date_end):
"""Get all punches fror all employees during the required date range."""
SQL = """
SELECT tp.inpunch_dt, tp.workingpunch_ts, tp.inout_id, job.job_id,
tp.task_id, tp.job_id, jobpunch_yn, job.jobname
@fwarren
fwarren / websever.py
Created February 8, 2021 19:25
Simple Python Web Sever to return System information
from itty import get, post, run_itty
import os, subprocess
@get('/env/(?P<name>\w+)')
def lookup_environ_variable(request, name):
return os.environ[name]
@get('/freespace')
def compute_free_disk_space(request):
return subprocess.check_output('df')
@fwarren
fwarren / withsqlite.py
Last active April 25, 2024 19:47
Simple sqlite3 context manager for Python 3 will type annotations
#!/usr/bin/env python
"""Open Sqlite3 databae with context manager"""
from pathlib import Path
from types import TracebackType
from typing import overload, Any, Optional, Union
class dbopen(): # pylint: disable=invalid-name
"""Simple context manager for sqlite3 databases"""
@fwarren
fwarren / LibreElecBackup.md
Last active December 1, 2021 05:46
Installing LibreElec From Backup

Partition Information

Partition      Files System  Label          Size        Flags
unallocated    unallocated                    4.00 Mib
/dev/sda1      fat16         LiBREELEC      512.00 Mib  boot,lba
/dev/sda2       ext4         STORAGE         28.46 Gib
  • Skip the first 4 mb on the stick
  • the booting partition is fat16 formatted and 512 mb in size (1/2 a gb) and is called LiBREELEC
  • the partiton with the data on it is ext4 formatted, it the rest of the space and called STORAGE