Skip to content

Instantly share code, notes, and snippets.

@neoneye
neoneye / main.py
Created March 14, 2024 15:41
Find available domain names by combining words
from tqdm import tqdm
import whois
import csv
# Base parts of the names to combine
base_parts = [
'paper', 'rock', 'scissors',
]
# Suffixes to append
@neoneye
neoneye / Logging.swift
Created March 29, 2019 16:16
SwiftyBeaver using Apple's unified logging system (OSLog)
// Copyright © 2019 Simon Strandgaard. All rights reserved.
import SwiftyBeaver
public let log = SwiftyBeaver.self
extension BaseDestination.LevelColor {
mutating func applyDefaultStyle() {
debug = "🏐 "
info = "🏐 "
verbose = "🏐 "
@neoneye
neoneye / guide.md
Last active November 20, 2022 14:26
Install GraphicsMagick on AWS EC2 running Ubuntu Linux
@neoneye
neoneye / gist:a54947142434492a2e73d2a678be869d
Created June 28, 2022 13:00
PARI/GP create OEIS bfile in browser
bfile(name, v, offset=1, limit=1000)={
my(cur=offset-1,F);
for(i=1,#v,
if (#Str(v[i]) > limit,
print("Next term has "#Str(v[i])" digits; exiting.");
break
);
my(s=Str(cur++, " ", v[i]));
print(s);
);
@neoneye
neoneye / a338277_integer.rb
Last active February 4, 2021 15:01
Integer sequence A338277 generates a sunflower
items = []
values = Array.new(1000) do |i|
n = i + 2
x = (n ** 2) / 2
y = Integer.sqrt(x)
value = x % y
items << [n, x, y, value]
value
end
IO.write('a338277_values.csv', values.join("\n"))
@neoneye
neoneye / text_plotter_example.rb
Created January 28, 2021 12:07
A340867 text scatter plot
def plot_modulus(values, count)
puts
s = values.map {|v| v.to_s(count) }.join('')
count.times do |i|
value = i.to_s(count)
re = Regexp.new("[^" + value + "]")
puts '# ' + s.gsub(re, ' ')
end
end
require 'prime'
def plot(values, modvalue)
puts
puts "plot(values, #{modvalue})"
s = values.map {|v| (v % modvalue).to_s(modvalue) }.join('')
modvalue.times do |i|
value = i.to_s(modvalue)
re = Regexp.new("[^" + value + "]")
puts '# ' + s.gsub(re, ' ')
@neoneye
neoneye / constant_to_primes.rb
Last active November 27, 2020 19:35
Reconstructing the primes from the Prime-Representing Constant 2.920050977316
# 2.920050977316 - A Prime-Representing Constant
# by Dylan Fridman, Juli Garbulsky, Bruno Glecer, James Grime, Massi Tron Florentin
#
# Numberphile
# https://www.youtube.com/watch?v=_gCKX6VMvmU
#
# Article
# https://arxiv.org/abs/2010.15882
#
# OEIS sequence
@neoneye
neoneye / main.rs
Last active November 18, 2020 21:57
Print out filename:linenumber when logging
use std::io::Write;
std::env::set_var("RUST_LOG", "debug");
env_logger::builder()
.format(|buf, record| {
writeln!(buf, "{} - {}:{} - {}", record.level(), record.file().unwrap_or("N/A"), record.line().unwrap_or(0), record.args())
})
.init();
require 'prime'
PRIMES = Prime.first(1000)
# Kevin Ryde pointed out that A337724 corresponds to this formula, with crazy rounding
# prime(n) - prime(n-2)/2 + prime(n-4)/2^2 - prime(n-6)/2^3 + ...
values = [0, 1]
30.times do |i|
sum = 0
power = 0
sign = 1