Skip to content

Instantly share code, notes, and snippets.

@9999years
9999years / pom.xml
Last active August 14, 2018 23:17
Maven POM boilerplate
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.whatever</groupId> <!-- this identifies you -->
<artifactId>pom-boilerplate</artifactId> <!-- this identifies the project -->
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<#
.DESCRIPTION
Moves the mouse cursor 1 pixel to the right and then back if the user hasn't
touched the computer in a bit
.PARAM CheckInterval
Interval between checks for idle-ness, in seconds. Default: 9.75 minutes
.PARAM MaxIdleTime
Maximum time since last input to trigger a mouse move, in seconds. Default: 9
@9999years
9999years / fingerstats.py
Last active May 30, 2018 03:47
hand stats for keyboard layouts
# code for determining how much of a word is typed with different hands in a given keyboard layout
# for the corncob list (http://www.mieliestronk.com/corncob_lowercase.txt), i got:
# >>> fingerstats.wordsfile('corncob.txt', fingerstats.qwerty)
# the left hand typed 59.29% of the letters
# the right hand typed 40.71%
#
# >>> fingerstats.wordsfile('corncob.txt', fingerstats.colemak)
# the left hand typed 50.56% of the letters
# the right hand typed 49.44%
#
function global:prompt {
$dir = (Get-Location).Path
# length being replaced
$len = $dir.Replace($Env:UserProfile, '~').Length
# name
$name = $null
Get-ChildItem Env: | %{
# length of replacing the value of $_ with $... in $dir
# add 1 for '$'
$newLen = $dir.Length - $_.Value.Length + $_.Name.Length + 1
# matricies that increase from left to right and top to bottom
import random
import math
def matrix(width, max_increase=3, max_seed=10):
"""
width: matrix width > 0
max_increase: the maximum increase between a cell and its lower / right
neighbors
@9999years
9999years / currency.ps1
Created December 14, 2017 20:17
powershell currency conversion
function currency {
Begin {
# make sure we can use Web.HttpUtility
Add-Type -AssemblyName System.Web
}
Process {
$encoded = [Web.HttpUtility]::UrlEncode($args -join " ")
$response = Invoke-WebRequest `
"https://google.com/search?q=$encoded"
// these are usually defined in math.h ...
#define NAN 0.0
// actually a bit smaller than DBL_MAX
#define INFINITY 1e+308
/**
* atof as described in ISO/IEC 9899:2011 (the C11 standard)
*
* case-insensitive input syntax EBNF:
*
" add all builtin keywords and methods/attributes to syntax
" put in $VIM/vimfiles/after/syntax/python.vim
if exists('b:loaded_pythoncustomsyntax')
finish
endif
let b:loaded_pythoncustomsyntax=1
syn keyword pythonExceptions ModuleNotFoundError
function run {
Start-Process $args[0] -ArgumentList (
$args[1..$args.Length] -join " "
)
}