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
# Compares 2 WP post tables to find published posts with the same name but different content | |
# Used after merging an old WP install into an existing one | |
import csv, difflib, hashlib, sys | |
file = open(1, encoding='utf-8') | |
main = [row for row in csv.reader(file)] | |
file = open(2, encoding='utf-8') | |
xen = [row for row in csv.reader(file)] | |
# There is no doubt a better way to do this using difflib, but I did this before finding out about it | |
main_posts = {} |
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
# Securely generate a hash for ansible | |
# don't paste the password into code at any point in time | |
from __future__ import print_function | |
from passlib.hash import sha256_crypt | |
from getpass import getpass | |
pw = getpass() | |
print(sha256_crypt.encrypt(pw)) |
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/python | |
from __future__ import print_function | |
import json | |
overarch = {} | |
overarch["us"] = [ | |
"kc.example.com", | |
"la.example.net", | |
] | |
overarch["germany"] = ["de.test.net"] |
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 hashlib, os, sys, re | |
from os.path import join, getsize | |
def sha512file(file): | |
sha512 = hashlib.sha512() | |
try: | |
f = open(file,"rb") | |
except IOError: | |
print("IO Error, unable to open file", file) | |
while True: |
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
def ary(p): | |
f = [0] | |
i = 1 | |
j = 0 | |
while i < len(p): | |
if p[i] == p[j]: | |
f.append(j+1) | |
i = i + 1 | |
j = j + 1 | |
elif j > 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
MOV r0, #0 | |
LDR r1, =N; N is label in memory, assuming it's +/- 4096 | |
MOV r2, #0; r2 is the counter | |
LOOP; just a label | |
MUL r3, r2, r2; i * i | |
ADD r0, r0, r3; total += i*i | |
ADD r2, r2, #1; i++ | |
CMP r2, r1; break out of loop when i = N | |
BNE LOOP |
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
今天我发现你的javascript想一个中文字是一个ASCII字。 | |
所以我现在用中文写比较多的东西。 | |
但是,我没有特别好的东西写。 | |
所以我希望你会以为写中文是一个非常独特的东西。 | |
Translated, it's: | |
Today I found out your javascript code is thinking one chinese character is equivalent to one standard ASCII character. | |
So I'm using Chinese to write more than I would otherwise be able to. | |
Unfortunately, I can't think of anything really interesting to write. | |
So I'm hoping you will think writing Chinese is a very unique thing. |
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 3 ]; then | |
echo "Usage: marmoset_submit course project file [...]" | |
exit 1 | |
fi | |
if [ $# -eq 3 ]; then | |
zip "$3" >& /dev/null | |
if [ $? -eq 12 ]; then | |
/u8/cs_build/bin/marmoset_submit "$@" | |
exit 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
#include <stdio.h> | |
#include <math.h> | |
#include <assert.h> | |
//c99 removed M_PI, so check if it's defined, if not, define it | |
#ifndef M_PI | |
#define M_PI acos(-1.0) | |
#endif | |
void triangles(double a, double b, double h){ |
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
for x in [3,4,6]: | |
if x == 3: | |
y = 8 | |
z = 4 | |
if x == 4: | |
y = 6 | |
z = 3 | |
if x == 6: | |
y = 4 | |
z = 2 |