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 sys | |
from rapidfuzz import process | |
# Translate typos made by rigsters989 in [GNOME] NA to | |
# a slightly more recognizable version of English. | |
def small(w, size=4): | |
'''Assume that Rigs probably won't spell really small words wrong.''' | |
return len(w) <= 4 |
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/python3 | |
def result_of(pool, skill, style, focus, difficulty): | |
'''Calculates the number of successes and complications from | |
pool: a list of results from d20s | |
skill: a number that determine's a character's skill level | |
style: a number that determine's a character's style proficiency | |
focus: the value under which a roll counts as a double success | |
difficulty: the number of successes''' | |
comp = 0 |
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
# prototypes.py -- James Murphy | |
# Construct arbitrary objects with default-initialized values | |
# and internal member dict-storage that provides javascript-like | |
# object prototyping. | |
import collections | |
def define(name, *args, bases=(object,), **fields): | |
if set(args) & set(fields.keys()): | |
raise ValueError('Member name(s) duplicated.') | |
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 sys | |
import operator | |
from functools import reduce | |
def digit_product(n): | |
return reduce(operator.mul, map(int, list(str(n)))) | |
def persistence(n, return_pair=False): | |
original = n | |
digits = len(str(n)) |
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 sys | |
symbols = { | |
'>' : '++ptr;', | |
'<' : '--ptr;', | |
'+' : '++*ptr;', | |
'-' : '--*ptr;', | |
'.' : 'putchar(*ptr);', | |
',' : '*ptr = getchar();', | |
'[' : 'while(*ptr) {', |
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
#include <stdio.h>/* | |
print'trick' | |
#*/ | |
#define pass int main(){puts("treat");return 0;} | |
pass |
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
while(dataForSession.next()) { | |
Object data[] = new Object[colNames.length]; | |
for (int i = 0; i < data.length; i++) { | |
data[i] = dataForSession.getObject(i+1); | |
//JOptionPane.showMessageDialog(null, data[i], "Database Column", JOptionPane.INFORMATION_MESSAGE); | |
rows.add(data[i]); // this line of code breaks everything | |
} | |
model.addRow(data); | |
} |
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.Serializable; | |
import java.util.prefs.Preferences; | |
import java.io.*; // Laziness | |
/** | |
* A class to abstract away storing persistent data using the java prefrences API | |
* and an IBM guide at ibm.com/developerworks/library/j-prefapi/ | |
* | |
* Example use: |
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
private static void put(Preferences prefs, String key, byte[] bytes) { | |
final int maxBytesPerKey = byteArrLen(); | |
final int keysNeeded = (int) Math.ceil((float) bytes.length / (float) maxBytesPerKey); | |
final int remainderBytes = bytes.length % maxBytesPerKey; | |
byte[][] splitBytes = new byte[keysNeeded][maxBytesPerKey]; | |
splitBytes[keysNeeded-1] = new byte[remainderBytes]; | |
for (int keyNum=0; keyNum < keysNeeded; keyNum++) { | |
for (int b=0; b < splitBytes[keyNum].length; b++) { | |
splitBytes[keyNum][b] = bytes[(keyNum * maxBytesPerKey) + b]; | |
} |
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
#include "stdio.h" | |
#include "string.h" | |
#define z 122 | |
int main(){ | |
char f[]={70,105,z,z,0},b[]={66,117,z,z,0},i=1,B[z],g; | |
for(i=1;i<=100;i++){ | |
g=0;if(i%3<1)strcpy(B,f),g=1; | |
if(i%5<1){if(g>0)strcat(B,b);else if(g<1)strcpy(B,b),g=1;} | |
if(g<1)printf("%d\n",i); | |
else printf("%s\n",B); |
NewerOlder