Skip to content

Instantly share code, notes, and snippets.

@B-Con
B-Con / MAL-soft-grey
Last active August 29, 2015 14:04
The CSS styling for one of my custom themes on MyAnimeList.net. It is style #251619.
/* Copyright (c) 2014 Brad Conte (brad@bradconte.com, http://myanimelist.net/profile/B-Con)
* License: http://opensource.org/licenses/MIT
* (Summary: You may use, edit, and redistribute this all you want. Just keep the top two lines of this file that credit me and mention the license.)
*
* Description: This is the CSS theme for my MAL list at http://myanimelist.net/animelist/B-Con .
* They generate the HTML, I just style it. Their HTML is quirky, to say the least parts, so I
* have a few hacks in here.
* This is an original work. Both the CSS and the set of "status" remote-control style
* icons that come with it. See the license information above.
*
@B-Con
B-Con / DigitalOceanAPI.py
Created September 4, 2013 00:49
A simple wrapper around the Digital Ocean API (https://api.digitalocean.com). Initialize it with your credentials, then perform Digital Ocean API requests and it returns the parsed JSON API response as a dict. It throws an exception on API errors and maintains the same HTTPS connection for the lifetime of the object. This minimizing the bookkeep…
"""A Python3 wrapper for the Digital Ocean API.
Brad Conte (brad@bradconte.com)
"""
from http.client import HTTPSConnection
from http.client import HTTPConnection
import ssl
import json
@B-Con
B-Con / samplecrypt.cpp
Last active December 18, 2015 07:29
crypt() examples used in my article on PHP's faulty implementation of crypt().
#include <stdio.h>
#include <string.h>
#include <crypt.h>
void printCryptResult(char *szSalt)
{
if (szSalt != NULL)
puts(szSalt);
else
puts("(NULL)");
@B-Con
B-Con / zero-fill.cpp
Last active December 15, 2015 05:08
Creates files filled with 0s until no more can be created. (Likely because the filesystem is full.) This allows the filesystem image to be compressed quickly and easily for backups.
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
typedef unsigned char BYTE;
#define TMP_FILENAME_BASE "TMP_ZERO_FILE_"
#define TMP_FILE_GROW_SIZE (1024*1024*16) // = 16 MB
#define MAX_EMPTY_FILES 10
@B-Con
B-Con / Credit Card Generator
Last active September 24, 2022 13:02
This JavaScript function generates random number strings that pass the Luhn checksum, the test that credit card numbers must conform to. It assumes there is an HTML radio input to indicate which company issued the card. This code is from my webpage here: http://bradconte.com/cc_generator.html.
// Copyright (c) 2015, Brad Conte (http://bradconte.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@B-Con
B-Con / MAL-black-and-white
Last active June 3, 2023 14:43
The CSS styling for one of my custom themes on MyAnimeList.net. It is style #ID101241.
/* Copyright (c) 2013 Brad Conte (brad@bradconte.com, http://myanimelist.net/profile/B-Con)
* License: http://opensource.org/licenses/MIT
* Summary: You may use, edit, and redistribute this all you want. Just keep the top two lines of this file that credit me and mention the license.
*
* This is the CSS theme for my MAL list at http://myanimelist.net/animelist/B-Con .
* They generate the HTML, I just style it. Their HTML is sometimes bizarre,
* sometimes horrible, so there are definitely some hacks.
*/
@import url('http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic');