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
function! CJKDefine(...) | |
if a:0 == 0 | |
let b:cjk_char = matchstr(getline('.'), '\%' . col('.') . 'c.') | |
else | |
let b:cjk_char = a:1 | |
endif | |
python3 << EOF | |
# unbelievable bullshit | |
setattr(sys, '__stdout__', sys.stdout) | |
from cihai.core import Cihai |
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
import math | |
import logging | |
def string(hashCode): | |
""" | |
The hash code for a String object is computed as | |
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] | |
using int arithmetic, where s[i] is the ith character of the string, n is | |
the length of the string, and ^ indicates exponentiation. (The hash value | |
of the empty string is zero.) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<assembly | |
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation=" | |
http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 | |
http://maven.apache.org/xsd/assembly-1.1.2.xsd" | |
> | |
<id>src</id> | |
<formats> |
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
<?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> |
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
<# | |
.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 |
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
# 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% | |
# |
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
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 |
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
# 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 |
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
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" |
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
// 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: | |
* |