Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mvanorder
mvanorder / diag.ipynb
Created May 12, 2020 04:55
diagonal list from a matrix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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 / 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 / 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 / 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
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 / 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