Skip to content

Instantly share code, notes, and snippets.

View msszczep's full-sized avatar

Mitchell Szczepanczyk msszczep

View GitHub Profile
@msszczep
msszczep / gist:a77c9361b9dfff6f8f57bf772ef5c2a4
Created July 28, 2016 15:43
Python script to filter "memorable" words from MRC Psycholinguistic Database
from itertools import product
final_answer = set()
for a in open('mrc2.dct'):
cols = a.split(' ', 1)
b = list(cols[0])
c = int(b[28] + b[29] + b[30]) # concreteness rating
i = int(b[31] + b[32] + b[33]) # imagery rating
f = int(b[25] + b[26] + b[27]) # familiarity rating
@msszczep
msszczep / gist:d74014b94eb6220f8c8289179ba69349
Created July 28, 2016 15:46
Wolfram Language code and list of English words classified as Noun, Verb, AND Adjective
Intersection[WordData[All, "Verb"], WordData[All, "Noun"], WordData[All, "Adjective"]]
{abstract,ace,ad-lib,advance,agglomerate,aggregate,alert,alien,alternate,antic,antique,arch,associate,average,azure,back,backhand,bankrupt,base,
bay,beat,beetle,best,better,bias,birch,bitter,black,blame,blank,blanket,blind,blindfold,blue,bluff,bombproof,bone,bootleg,boss,bottom,bound,
brag,brave,brief,broadside,bronze,brown,buckram,buff,bully,bum,burlesque,bush,bust,calm,camp,carmine,center,champion,chance,charcoal,
chelate,clarion,clean,clear,close,cod,collect,color,colour,compact,compound,concrete,confederate,conglomerate,conjugate,content,converse,cool,
coordinate,correlate,counter,counterfeit,crack,crackle,crank,crescendo,crimson,crisp,crisscross,cross,cut,damascene,damn,damp,deaf,
decrescendo,degenerate,deviate,discontent,divine,double,down,dread,dress,dry,dummy,dun,duplex,duplicate,elect,empty,equal,even,express,
faint,fair,fake,fancy,fast,fat,fell,fine,firm,fit,flagellate,flash,fleet,flip,flush,fly,forfeit,forward
@msszczep
msszczep / subanagram.pl
Created August 22, 2016 09:18
Subanagram Generator in Perl, version 1
#!/usr/local/bin/perl
# subanagram.pl
# This program receives as input an English word, and then
# delivers as output those English words which can be spelled with the
# letters in the input word.
# This script is Copyleft 2002 by Mitchell Szczepanczyk under the
# terms of the General Public License. Anyone is free to copy, modify,
@msszczep
msszczep / subanagram2.pl
Created August 22, 2016 09:20
Subanagram Generator in Perl, version 2
#!/usr/bin/perl
# subanagram.pl
# This program receives as input an English word, and then
# delivers as output those English words which can be spelled with the
# letters in the input word.
# This script is Copyleft 2002 by Mitchell Szczepanczyk under the
# terms of the General Public License. Anyone is free to copy, modify,
@msszczep
msszczep / subanagram.py
Created September 16, 2016 17:58
Subanagram Generator in Python, v1
#!/usr/bin/python
# subanagram.py
# This program receives as input an English word, and then
# delivers as output those English words which can be spelled with the
# letters in the input word.
# This script is Copyleft 2002, 2012 by Mitchell Szczepanczyk under the
# terms of the General Public License. Anyone is free to copy, modify,
@msszczep
msszczep / gist:56189ad10e9a1625178fa6ca4c7b5c85
Created November 13, 2016 16:01
Most Z's on a MLB Team Roster, Mathematica
Count[Characters@ToLowerCase@WolframAlpha["1971 texas rangers roster", {{"Result", 1},  "Plaintext"}, PodStates -> {"More"}], "z"];
MLBTeams = Drop[StringSplit[WolframAlpha["all major league baseball teams", {{"Result", 1},  "Plaintext"}, PodStates -> {"More", "More"}], {"(", "|"}], -1];
Grid[Take[Reverse@SortBy[First@Table[{team, yr, Count[Characters@ToLowerCase@WolframAlpha[ToString[yr] <>  " " <>  team <>  " roster", {{"Result", 1},  "Plaintext"}, PodStates -> {"More"}], "z"]}, {team, MLBTeams}, {yr, Range[1903, 2016]}], Last], 40], Frame-> All]
@msszczep
msszczep / gist:9ad519c9a3000eff58c8c533f80c85f2
Last active July 30, 2018 19:25
Are You Polish? (in Clojure)
; https://gist.github.com/Youenn-Bouglouan/02cd3ac6fd0130cc48b207eec6049af6
;
; http://www.ybouglouan.pl/2017/03/are-you-polish-fharp-will-tell-us-probably/
(defn are-you-polish? [surname]
(letfn [(score-polish-characters
[surname]
(->> (re-seq #"[ąćęłńóśżź]" surname)
count))
@msszczep
msszczep / faceoff.clj
Created June 10, 2017 15:51
Faceoff: America's favorite new card game -- in Clojure
(ns faceoff.core)
;; Make deck of cards, shuffle
;; loop:
;; does a player have zero cards?
;; if yes: game over
;; if no: faceoff
;; determine winner, winner gets cards added
;; if tie:
;; does 1 player have < 5 cards
@msszczep
msszczep / SubanagramGenerator.elm
Created September 4, 2017 19:54
Subanagram Generator in Elm
port module SubanagramGenerator exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.App as App
import String exposing (toLower, toList)
import Ni2Dictionary
import Char exposing (isLower)
import Dict exposing (Dict)
| Surround parens | M-shift-9 |
| slurp right | ctrl-shift-right_arrow |
| barf right | ctrl-shift-left_arrow |
| slurf left | ctrl-shift-9 |