Skip to content

Instantly share code, notes, and snippets.

@efuquen
efuquen / memory.py
Last active May 7, 2021 22:21
memory.py
from sense_hat import SenseHat
import time
import random
sense = SenseHat()
#declare color tuples
r = (255,0,0)
w = (255,255,255)
k = (0,0,0)
Traceback (most recent call last):
File "manage.py", line 23, in <module>
main()
File "manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/Users/efuquen/.pyenv/versions/3.8.3/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/efuquen/.pyenv/versions/3.8.3/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/efuquen/.pyenv/versions/3.8.3/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
@efuquen
efuquen / gist:a6339132b420ac5df37f19cb541ff3a1
Created June 19, 2020 04:17
PIT migration script error
migration_1 | Operations to perform:
migration_1 | Apply all migrations: admin, auth, contenttypes, sessions, survey
migration_1 | Running migrations:
migration_1 | Applying survey.0006_auto_20200616_1856...Traceback (most recent call last):
migration_1 | File "manage.py", line 23, in <module>
migration_1 | main()
migration_1 | File "manage.py", line 19, in main
migration_1 | execute_from_command_line(sys.argv)
migration_1 | File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
migration_1 | utility.execute()
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {number[]} preorder
* @return {TreeNode}
" Installs vim-plug.
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
mport csv
import locale
import sys
locale.setlocale(locale.LC_ALL, '')
csv_filepath = sys.argv[1]
winners = []
with open(csv_filepath, 'rb') as csvfile:
@efuquen
efuquen / gnews-top-stories.js
Created August 18, 2015 02:35
Google News Top Stories Scraper
var request = require('request');
var cheerio = require('cheerio');
request('https://news.google.com/', function(error, response, body) {
if (!error && response.statusCode == 200) {
getTopStories(body);
} else {
console.error(error);
console.error('Status Code: ' + response.statusCode);
}
cur_alpha_str = ""
long_alpha_str = ""
for c in s:
if len(cur_alpha_str) == 0 or c >= cur_alpha_str[-1]:
cur_alpha_str += str(c)
else:
if len(cur_alpha_str) > len(long_alpha_str):
long_alpha_str = cur_alpha_str
cur_alpha_str = str(c)
cur_alpha_str = ""
longest_alpha_str = ""
for letter in s:
if cur_alpha_str == "" or letter > cur_alpha_str[-1]:
cur_alpha_str += letter
else:
if len(cur_alpha_str) > len(longest_alpha_str):
longest_alpha_str = cur_alpha_str
cur_alpha_str = str(letter)
@efuquen
efuquen / scripted-music-3-17-2015.md
Last active August 29, 2015 14:17
ScriptEd Music Assignment 3-17-2015

Fork This: http://codepen.io/efuquen/pen/RNqxEV

##Part 1

  1. Play a D note for 1 beat, a F note for 1 beat, and a A note for 2 beats.
  2. Use a while loop to play the notes from the exercise 1 three times. Like so: D, F, A, D, F, A, D, F, A
  3. Use a while loop to play the same note 3 times for 1 beat.

##Part 2