Skip to content

Instantly share code, notes, and snippets.

/* If your shitbox doesn't have getopt, step into the nineties already. */
/* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */
while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) {
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */
switch (x) {
case 'a':
bail ("all-A-records NIY");
o_alla++; break;
#ifdef GAPING_SECURITY_HOLE
case 'e': /* prog to exec */
@$container.on 'submit', (e) =>
e.preventDefault()
formData = new FormData(@$container.get(0))
formData.append("user[settings_file]", @file)
$.ajax({
url: @$container.attr('action'),
type: @$container.attr('method'),
contentType: false,
processData: false,
data: formData,
object Matasano {
def hexToBytes(hex: String): Array[Byte] = {
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2,2).toArray.map(Integer.parseInt(_, 16).toByte)
}
def bytesToHex(bytes: Array[Byte]): String = {
bytes.map("%02x" format _).mkString
}
def encode64(b: Array[Byte]): String = {
import praw
r = praw.Reddit('Homophone Triplet Game by /u/NotFlameRetardant')
r.login('HomophoneTripletBot', PASSWORD, disable_warning=True)
submission = r.get_submission(submission_id='3j1lso')
flat_comments = praw.helpers.flatten_tree(submission.comments)
already_done = set()
count = 0
wordset = [['there', 'their', 'they\'re'], ['two', 'too', 'to'], ['buy', 'by', 'bye'], ['write', 'right', 'rite']]
import praw
r = praw.Reddit('Homophone Triplet Game by /u/NotFlameRetardant')
r.login('HomophoneTripletBot', PASSWORD, disable_warning=True)
submission = r.get_submission(submission_id='3j1lso')
flat_comments = praw.helpers.flatten_tree(submission.comments)
already_done = set()
count = 0
wordset = [['there', 'their', 'they\'re'], ['two', 'too', 'to'], ['buy', 'by', 'bye'], ['write', 'right', 'rite']]
/**
* Returns a text from html file content without user's tags and their bodies.
*
* @param is an input stream with html file content.
* @return The string only with text from file content.
*/
public String getContentAsText(InputStream is) throws IOException, DocumentReadException
{
if (is == null)
{
def decodeSingleByteXOR(cipherText: String, char: Char): String = {
val cipherTextByteArray = decodeHex(cipherText)
new String(cipherTextByteArray.zip(Array.fill(cipherTextByteArray.length)(char)).map((t) => t._2 ^ t._1).map(_.toByte), "UTF-8")
}
def bruteForceSingleByteXOR(cipherText: String): Array[String] = {
(('A' to 'Z') ++ ('a' to 'z') ++ ('0' to '9')).toArray.map(decodeSingleByteXOR(cipherText,_))
}
def decodeHex(hex: String): Array[Byte] = {
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
~ pbpaste | ruby -ne 'require "base64";enc=Base64.decode64($_.chars.each_slice(8).map(&:join).map{|byte|byte.to_i(2)}.map(&:chr).join);ascii=enc.split("").map{|chr|chr.ord};1.upto(26){|i| p ascii.map{|chr| (chr+i).chr}.join}'
"NEBJLLLNRBNLMFLEOBNESBEUMFRROLFBOOSBFLTFFFWIOMRLSNRRMFOEMERWRFTMMLBOJRMWFLELBMTOBFHFWBBMOSSJRMM"
"OFCKMMMOSCOMNGMFPCOFTCFVNGSSPMGCPPTCGMUGGGXJPNSMTOSSNGPFNFSXSGUNNMCPKSNXGMFMCNUPCGIGXCCNPTTKSNN"
"PGDLNNNPTDPNOHNGQDPGUDGWOHTTQNHDQQUDHNVHHHYKQOTNUPTTOHQGOGTYTHVOONDQLTOYHNGNDOVQDHJHYDDOQUULTOO"
"QHEMOOOQUEQOPIOHREQHVEHXPIUUROIERRVEIOWIIIZLRPUOVQUUPIRHPHUZUIWPPOERMUPZIOHOEPWREIKIZEEPRVVMUPP"
"RIFNPPPRVFRPQJPISFRIWFIYQJVVSPJFSSWFJPXJJJ[MSQVPWRVVQJSIQIV[VJXQQPFSNVQ[JPIPFQXSFJLJ[FFQSWWNVQQ"
"SJGOQQQSWGSQRKQJTGSJXGJZRKWWTQKGTTXGKQYKKK\\NTRWQXSWWRKTJRJW\\WKYRRQGTOWR\\KQJQGRYTGKMK\\GGRTXXOWRR"
"TKHPRRRTXHTRSLRKUHTKYHK[SLXXURLHUUYHLRZLLL]OUSXRYTXXSLUKSKX]XLZSSRHUPXS]LRKRHSZUHLNL]HHSUYYPXSS"
"ULIQSSSUYIUSTMSLVIULZIL\\TMYYVSMIVVZIMS[MMM^PVTYSZUYYTMVLTLY^YM[TTSIVQYT^MSLSIT[VIMOM^IITVZZQYTT"
"VMJRTTT