Skip to content

Instantly share code, notes, and snippets.

A.G. antiface

Block or report user

Report or block antiface

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
antiface /
Created Sep 13, 2018 — forked from josephmisiti/ - a simple genetic algorithm in Python
""" implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
The parameters of the simulation can be changed by modifying one of the many
global variables. To change the "most fit" string, modify OPTIMAL. POP_SIZE
controls the size of each generation, and GENERATIONS is the amount of
generations that the simulation will loop through before returning the fittest
antiface /
Created Sep 16, 2017 — forked from aunyks/
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp = data
self.previous_hash = previous_hash
# A.G. (c) 2017. All Rights Reserved.
# January 4th, 2017
import time
class EnterSourceCode:
def __init__(self, time, filename, sourcecode, category):
self.time = time
self.filename = filename
# DATETIME: (date at top)
# EXPERIMENT: (number and title clearly stated)
# (Clear statement of purpose)
# PROCEDURE: (succinct description of procedure
View ex1.c
#include <stdio.h>
typedef struct {
char * name;
int age;
} person;
int main() {
person john;
antiface /
Created Aug 9, 2016 — forked from aewallin/
very simple Mersenne prime search
# very simple Mersenne prime search.
# AW2016-01-23
import time
import math
def prime_sieve(n):
size = n//2
import math
import random
def str_to_ascii(text):
""" Gets rid of on ASCII characters in text"""
return ''.join(ch for ch in text if ord(ch)<128)
def maxmatch(T, p, w=2**12-1, max_length=2**5-1):
""" finds a maximum match of length k<=2**5-1 in a
w long window, T[p:p+k] with T[p-m:p-m+k].
import http.client
import random
def random_string(n):
return "".join(chr(random.randrange(128)) for i in range(n))
def str_to_bin(text):
""" translates text to binary reprersentation using
7 bits per character. Non ASCII characters are discarded"""
return ''.join('{:07b}'.format(ord(ch)) for ch in text if ord(ch) < 128)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
The VerilogBits provides Verilog-style representation of the numbers.
Copyright (C) 2015 Jan Marjanovic <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
You can’t perform that action at this time.