Skip to content

Instantly share code, notes, and snippets.

from math import sqrt
# 2 constants: the square root of 2, and the raduis of the circle we're
# drawing.
ROOT_2 = sqrt(2)
RADIUS = float(1000000000)
# 2 variables: current x position, and the area of the circle being
# calculated.
x = RADIUS
@mvanorder
mvanorder / sqrt.c
Created August 16, 2018 16:55
A small program that finds the perfect square root that is closest to but not over the root of the provided integer.
#include <stdio.h>
#include <stdlib.h>
void main(int argc, char **argv) {
unsigned int n; // Input number
unsigned int n2; // Duplicate of input number to be worked with
int s = 0; // Shift counter
unsigned int a = 0; // Answer
unsigned int c = 0; // Carry number
n = atoi(argv[1]); // Read the first parameter provided and convert it to int
@mvanorder
mvanorder / sqrt2.c
Created August 16, 2018 19:55
A small program that finds the closest square root to the provided integer.
#include <stdio.h>
#include <stdlib.h>
void main(int argc, char **argv) {
unsigned long n; // Input number
unsigned long n2; // Duplicate of input number to be worked with
short s = 0; // Shift counter
unsigned long a = 0; // Answer
unsigned long c = 0; // Carry number
n = atoi(argv[1]); // Read the first parameter provided and convert it to int
2018-08-26 15:15:24,041 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
2018-08-26 15:15:24,066 INFO sqlalchemy.engine.base.Engine ()
2018-08-26 15:15:24,070 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
2018-08-26 15:15:24,073 INFO sqlalchemy.engine.base.Engine ()
2018-08-26 15:15:24,077 INFO sqlalchemy.engine.base.Engine PRAGMA table_info("person")
2018-08-26 15:15:24,079 INFO sqlalchemy.engine.base.Engine ()
2018-08-26 15:15:24,082 INFO sqlalchemy.engine.base.Engine
CREATE TABLE person (
id INTEGER NOT NULL,
name VARCHAR(30),
@mvanorder
mvanorder / init.el
Last active March 11, 2019 16:47
My Emacs config
;; init.el --- Emacs configuration
;; INSTALL PACKAGES
;; --------------------------------------
(require 'package)
;(add-to-list 'package-archives
; '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
@mvanorder
mvanorder / cards.py
Last active January 5, 2019 03:35
python oop deck with holdem deal
import random
class Card(object):
def __init__(self, suit, rank):
self.__suit = suit
self.__rank = rank
@property
def suit(self):
@mvanorder
mvanorder / hexchat_listener.py
Created February 12, 2019 20:55
Listen to Hexchat irc log with Google translate voice.
import os
import re
import time
from google_speech import Speech
sox_effects = ("speed", "1.5", "pitch", "-700")
filename = os.path.join(os.path.expanduser('~'), '.config', 'hexchat', 'logs', 'freenode', '#python.log')
@mvanorder
mvanorder / irc_tts.py
Created February 13, 2019 14:13
Listen to IRC channels
import os
import re
import time
import sys
from google_speech import Speech
sox_effects = ("speed", "1.4", "pitch", "-600")
mode = 'irssi'
@mvanorder
mvanorder / rand_key_gen.py
Last active July 20, 2019 03:10
Generate a random key string
# Generate a random string of random characters randomized in lenght of 42 to 64
# the characters used are char 33 through 126, or:
# '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
print(''.join((chr(random.randrange(33, 127)) for i in range(random.randrange(42, 65)))))
@mvanorder
mvanorder / diag.ipynb
Created May 12, 2020 04:55
diagonal list from a matrix
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.