Skip to content

Instantly share code, notes, and snippets.

View dylnmc's full-sized avatar

dylnmc dylnmc

View GitHub Profile
@dylnmc
dylnmc / snow.py
Last active May 14, 2024 14:40
tkinter snow
#! /usr/bin/env python2
"""
This is one of the cooler python scripts that uses simple animation in Tkinter.
A bunch of white circles start positioned at the top of the Tkinter panel when it opens.
Then, on a light grey background, the snowflakes gently fall downwards. When they reach
the bottom, they apparently disappear and start back above the top of the screen and
fall back into view. This continuous and soothing snow fall was so relaxing that I made
it open in the background of my mac terminal, which had a transparent background.
@dylnmc
dylnmc / flies.py
Last active March 20, 2018 14:49
tkinter flies
#! /usr/bin/env python2
"""
This is an interesting script, to say the least, using simple animation in Tkinter.
A few of green circles start positioned at the top-left of the Tkinter panel when it
opens. Then, on a white background, the flies disperse and move in all directions in a
randomized way. If they hit the edge of the screen, they jump backwards as if it
shocked them. The random, even chaotic, movement of the circles makes them appear to be
a lot of flies buzzing around the screen.
@dylnmc
dylnmc / bubbles.py
Last active January 2, 2023 12:05
tkinter bubble
#! /usr/bin/env python2
"""
This is a very bubbly yet simple animation in python's Tkinter.
A lot of turquoise circles start positioned at the bottom of the Tkinter panel when
it opens. Then, on a blue background, The bubbles float fall upwards. Depending on their
size, the rise at different speeds: the bigger the faster. When they reach the top, they
apparently disappear and start back below the bottom of the screen and float back into
view. It's really fun to watch it for a minute or so.
@dylnmc
dylnmc / cursors.py
Last active August 29, 2015 14:10
Cursors
#! /usr/bin/env python
"""
View all of the cursors for your operating system and their names in a nice Tkinter-based Python script.
"""
__author__ = "dylnmc"
from Tkinter import *
# All of the cursors I could find - ordered very nicely for you :)
@dylnmc
dylnmc / TicTacToe.c
Last active December 24, 2018 12:31
Best Tic-Tac-Toe game in C for Unix - use the arrow keys to navigate and Space or Enter to select
/*
This game is for Unix only.
It is a simple yet easily navigable Tic-Tac-Toe game for the Unix terminal. To run this file, go
to your awesome Unix terminal (after you have downloaded this text file, of course) and
navigate to this file. Then, compile and link the program with your handy compiler (which will
almost definitely be installed unless you have removed it) using the command 'gcc TicTacToe.c'.
This creates an executeable. To run it, you can simply type './a.out'. If you want to have a more
memorable file and/or prevent conflicts, simply change the name with the 'mv' tool
('mv a.out TicTacToe') or use the '-o' ("output file") when compiling
@dylnmc
dylnmc / pi.py
Created April 14, 2015 16:09
Pi py - simple pi calculation in python
#! /usr/bin/env python
__author__ = "dylnmc"
def main():
from decimal import Decimal, getcontext
from os import nice
getcontext().prec = 100
two = Decimal("2.0")
@dylnmc
dylnmc / scrambledEggs.py
Last active September 1, 2016 04:11
Hungry? Have some scrambled eggs!
#!/usr/bin/env python3
if __name__ == '__main__':
from sys import platform
if not platform.startswith('linux'):
from sys import stderr
print('Sorry; this only works in Linux!', file=stderr)
exit(1)
from os import system
from random import randint
#!/bin/sh
# view here:
# https://i.stack.imgur.com/OK3po.png
e=$'\e['
for n in {0..7}; do
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
@dylnmc
dylnmc / rgb2hex.py
Last active October 14, 2017 20:13
convert rgb to hex from cli
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main(rgb):
if len(rgb) != 3 and len(rgb) != 4:
from sys import stderr, exit
stderr.write('expected either "r g b" or (r,g,b) as input\n')
exit(2)
print("#"+("{:02x}"*3).format(*rgb[:3]))
" v!autocmd (:
augroup Vimrc " (:
autocmd!
" vim shenanigans
autocmd WinEnter,BufWinEnter $HOME/simplevimrc.vim call <sid>setupVimFile()
autocmd BufWinLeave $HOME/simplevimrc.vim call <sid>cleanupVimFile()
autocmd BufRead,TextChanged,FileChangedShellPost,FileReadPost,FilterReadPost,ShellFilterPost $HOME/simplevimrc.vim call <sid>computeFirstFolds()