This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a quick and dirty script that emails an admin about any new IP addresses found in the auth.log. | |
# It includes the last 10 lines featuring a new IP along with output from ip-api.com. | |
# It saves identified IPs in a text file to prevent repeat reporting. | |
# Set this up to run as a cron job to be notified of any new networks authenticating on your Linux server. | |
import sys | |
import os | |
import subprocess | |
msg_filename = 'monitor_auth.msg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script changes the path for a folder or file in Navidrome's database, allowing music files to be | |
# moved or renamed on the file system without losing associated metadata in Navidrome. Since the original | |
# version, it has been updatd to account for the media_file IDs, which are calculated from the path value | |
# and referenced in several tables. | |
# | |
# This script is based on Navidrome version 0.49.2. If you are running an older version of Navidrom, it | |
# will likely fail. If you are running a newer version of Navidrome, your mileage may vary. | |
# | |
# It does NOT make any modifications to the file system - only to the Navidrome database. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create database <name>; | |
use <name>; | |
grant all on <name>.* to <user>@'%' idendified by '<password>''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set number | |
set swapfile | |
set dir=c:/temp | |
colorscheme slate | |
filetype plugin indent on | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
Single file Tic Tac Toe against the Computer | |
https://gist.github.com/wiseley/9458565/ | |
Author: Matt Wiseley | |
License: GPL - http://www.gnu.org/licenses/gpl.html | |
--> | |
<html> | |
<head> | |
<meta charset="UTF-8"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* PROBLEM: | |
* Write a class to support the following website feature. On each product | |
* detail page, display the number of hits in the past 10 minutes if there have | |
* been at least 10. Otherwise, display the number of hits in the past hour if | |
* there have been at least 10. Otherwise, display the number of hits in the | |
* past 24 hours if there have been at least 10. Otherwise, display nothing. | |
* There is no analytics service available to provide realtime reporting on the | |
* number of hits, so this class must also collect that data. It should aim to | |
* work on a website that has a few million product pages and gets 10 million | |
* unique visitors per day. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reverse word and compare | |
function isPalindrome1(word) { | |
var s = ''; | |
for (var i=word.length-1; i>=0; i--) { | |
s += word[i]; | |
} | |
return s === word; | |
} | |
// compare from end to end (more efficient) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Parameterized string for safe sql queries, read from a sql.properties file | |
* Use: Statement.create("property.name") | |
* .set(":id", 123) | |
* .set(":date", new Date()) | |
* .set(":name","O'Hara") | |
* .toString(); | |
*/ | |
package com.wiseley.util; |