This file contains hidden or 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
#!/bin/sh | |
git log --shortstat | perl -ne 'chomp; $author = $1 if m/^Author: (.*)/; if (m/(\d+) files? changed, (\d+) insertions.* (\d+) deletions/){ $files{$author} += $1; $insertions{$author} += $2; $deletions{$author} += $3 }; END { foreach $author (sort { $files{$b} <=> $files{$a} } keys %files) {printf("%s: %d files, %d insertions(+), %d deletions(-)\n", $author, $files{$author}, $insertions{$author}, $deletions{$author})}}' |
This file contains hidden or 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
def previous_current_next(iterable): | |
"""Make an iterator that yields an (previous, current, next) tuple per element. | |
Returns None if the value does not make sense (i.e. previous before | |
first and next after last). | |
""" | |
iterable=iter(iterable) | |
prv = None | |
try: | |
cur = next(iterable) |
This file contains hidden or 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
#!/bin/sh | |
# Remove duplicates from MPD playlist. | |
# Export MPD_HOST and MPD_PORT if you want to connect to a different host. | |
mpc playlist -f '%position%\t%file%' | sort -k 2 | perl -ne 'm/(.*)\t(.*)/; print "$1\n" if $2 eq $prev; $prev=$2' | mpc del |
This file contains hidden or 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
#!/bin/sh | |
# Convert CSV files into Excel format | |
# See | |
# https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Filter_Options_for_the_CSV_Filter | |
# | |
# 44 = ASCII code of »,« | |
# 34 = ASCII code of »"« | |
# UTF-8 input encoding | |
# 1 = Start in line 1 = first line | |
# Empty column options = import all as “Standard” formatted |
This file contains hidden or 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
-- Show databases with no current connections | |
-- | |
-- BIG FAT WARNING: Don't trust this blindly! Just because there's no *current* | |
-- activity does not mean a database is no longer needed. | |
-- | |
SELECT | |
(pg_stat_file ('base/' || d.oid || '/PG_VERSION')).modification, | |
d.datname, | |
pg_size_pretty(pg_database_size(d.datname)) AS size | |
FROM pg_database d |
This file contains hidden or 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
#!/usr/bin/env python | |
import json | |
import requests | |
JIRA_URL = 'https://JIRA base URL' #Fill in your JIRA Root | |
WebSession = requests.Session() | |
WebSession.auth = ('username','password') #JIRA Credentials go here, Optionally use Base64 Encode/Decode | |
WebParams = {'jql':'watcher = currentUser()', 'fields':'key,summary', 'maxResults':'9999'} #You can use basically any JIRA search query here in the JQL parameter |
This file contains hidden or 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
find . -type d -name target -prune -o -type f -name "*.xml" -path "*/src/main/resources/*" -exec grep -i --color=yes stuff '{}' + |
This file contains hidden or 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 java.io.IOException; | |
import ucar.nc2.Attribute; | |
import ucar.nc2.Group; | |
import ucar.nc2.NetcdfFile; | |
import ucar.nc2.Variable; | |
import ucar.nc2.iosp.hdf5.H5iosp; | |
import ucar.nc2.util.DebugFlags; | |
/** |
This file contains hidden or 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 java.util.Hashtable; | |
import javax.naming.Context; | |
import javax.naming.NamingEnumeration; | |
import javax.naming.NamingException; | |
import javax.naming.directory.Attribute; | |
import javax.naming.directory.Attributes; | |
import javax.naming.directory.DirContext; | |
import javax.naming.directory.InitialDirContext; |
This file contains hidden or 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
#!/usr/bin/perl | |
use POSIX; | |
use strict; | |
sub hsv2rgb { | |
my ( $h, $s, $v ) = @_; | |
if ( $s == 0 ) { | |
return $v, $v, $v; |