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 abc | |
import collections.abc | |
class KeyTransformDictionaryBase(dict, abc.ABC): | |
__slots__ = () | |
@abc.abstractmethod | |
def __key_transform__(self, key): |
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
#!/usr/bin/python3 -OO | |
import sys | |
import operator | |
import scholarly | |
import urllib.parse | |
DEFAULT_ATTRIBUTES = ( | |
'citedby', 'citedby5y', | |
'hindex', 'hindex5y', | |
'i10index', 'i10index5y' |
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
#!/usr/bin/python3 | |
import sys | |
import locale | |
import functools | |
from datetime import datetime | |
timefmt = '%b %d %H:%M:%S' | |
def parse_arg_time(s): |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <errno.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc <= 0) |
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
#!/usr/bin/python3 | |
import sys | |
with open(sys.argv[1]) as dict_file: | |
dictionary = dict(line.rstrip('\n').split(None, 1) for line in dict_file) | |
with sys.stdin: | |
for line in sys.stdin: | |
line = line.rstrip('\n') | |
print(dictionary.get(line, line)) |
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
#!/bin/bash | |
set -eu -o noclobber | |
outfile_format='Screenshot %(%F %T)T' | |
imgext=png | |
screenshot='gnome-screenshot -f' | |
postprocessor=gimp | |
# Discover user picture directory | |
user_dirs="${XDG_CONFIG_HOME:-"$HOME/.config"}/user-dirs.dirs" | |
[ ! -e "$user_dirs" ] || source "$user_dirs" |
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
#!/bin/sh | |
INPUT=doc.pdf | |
OUTPUT=doc.ps | |
PASSWORD=foobar | |
gs -sDEVICE=pswrite -dSAFER -dBATCH -dNOPAUSE \ | |
-dColorConversionStrategy=/LeaveColorUnchanged -dDownsampleMonoImages=false -dDownsampleGrayImages=false \ | |
-dDownsampleColorImages=false -dAutoFilterColorImages=false -dAutoFilterGrayImages=false \ | |
-dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dPassThroughJPEGImages=true \ | |
-sPDFPassword="$PASSWORD" -sOutputFile="$OUTPUT" "$INPUT" |
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
#!/bin/bash | |
set -eu | |
declare -r TMP="${1:-"${TMP:-/tmp}/find-test"}" | |
declare -ri file_count="${2:-1000000}" pad="${3:-255}" | |
declare -ar find=( find "$TMP" -mount -mindepth 1 ) | |
# Preparation | |
mkdir -p -- "$TMP" | |
declare -i free_inodes="$(stat -f -c %d -- "$TMP")" | |
if [ "$free_inodes" -gt 0 ]; then |
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 sys, random | |
if len(sys.argv) < 3: | |
sys.argv.append(input()) | |
cropsize = float(sys.argv[1]) | |
llx, lly, urx, ury = map(float, sys.argv[2].split(None, 3)) | |
width = urx - llx | |
height = ury - lly |
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
--- Indexing_unix.sh 2016-10-04 10:38:56.804167702 +0200 | |
+++ Indexing_unix.sh 2016-10-04 10:48:30.712992854 +0200 | |
@@ -105,16 +105,16 @@ | |
fi | |
fi | |
- if [ "$ver_major" = "" ]; then | |
- return; | |
- fi | |
- if [ "$ver_major" -gt "1" ]; then |
NewerOlder