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 | |
# script to set the default boot partition to Windows | |
# intended for Fedora20 with Grub2 | |
# https://ask.fedoraproject.org/en/question/9257/dual-boot-fedora-16-windows/ | |
# the configuration file of the bootloader | |
conf=/boot/grub2/grub.cfg | |
echo "Examining $conf..." |
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/sh | |
set -o errexit | |
archdir=$(pwd)/arch-to-git/archives | |
repodir=$(pwd)/arch-to-git/repo | |
mkdir -p "$archdir" "$repodir" | |
pushd "$archdir" |
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 | |
target=0d149b90e7394297301c90191ae775f0 | |
read -r -d '' words <<WORDS | |
ad ah am an as at aw ax ay | |
be by do go ha he hi if in is | |
it me my no of oh on or ow | |
ox pi so to uh um up us we | |
WORDS |
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 | |
if [ "$#" -lt 0 -o "$#" -gt 3 ];then | |
echo -e "\nUsage: decr [<input file>] [<RSA's d>] [<RSA's n>]\n" | |
echo -e 'input file is "ciphermessage" by default' | |
echo -e 'private key is 5783-and-7031 by default\n' | |
exit 1 | |
fi | |
# default private key is 5783-and-7031 |
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 | |
# ncoop 2015/08/13 | |
set -uoe pipefail | |
IFS=$'\n\t' | |
usage() { | |
cat << EOF | |
Determine whether a number is a primitive root of a given prime. |
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 java.util.Arrays; | |
import java.util.HashSet; | |
/** | |
* Demonstrates O(n) solutions to the problem of finding two elements in a series that add to a given sum. | |
* @author ncoop | |
*/ | |
public class TwoSums { | |
/** | |
* Given an unsigned integer array <b>a</b> and a target unsigned integer <b>k</b>, returns a two-element int array |
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/python3 | |
__author__ = 'ncoop' | |
from re import search, VERBOSE, IGNORECASE | |
roman_pattern = ''' | |
^ | |
# M: thousands | |
((?P<m1000>M)|(?P<m2000>MM)|(?P<m3000>MMM))? |
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 | |
# ImageMagick script to generate github/bitbucket avatar | |
# http://www.imagemagick.org/Usage/draw/ | |
out=${HOME}/Documents/eagle.png | |
side=420 | |
tile=60 | |
marg=30 | |
canvas="#f0f0f0" |
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
require 'matrix' | |
class Matrix | |
# Attempt to recast each entry of the matrix to clazz | |
def to(clazz) | |
self.each_with_index do |entry, i, j| | |
self[i, j] = send(clazz.name.to_sym, entry) | |
end | |
end | |
end |
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/env python3 | |
def parseArgs(): | |
from sys import stderr | |
import argparse | |
from os.path import expanduser, isfile | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
'-f', '--file', help='file to be cleaned', |
OlderNewer