Skip to content

Instantly share code, notes, and snippets.

View 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)
View gist:5bd3c22eabbcb85af3e251f544939901
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
View gist:a6339132b420ac5df37f19cb541ff3a1
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()
View Construct Binary Search Tree from Preorder Traversal.js
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {number[]} preorder
* @return {TreeNode}
View .vimrc
" 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'
View winner_and_losers.py
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 Aug 18, 2015
Google News Top Stories Scraper
View gnews-top-stories.js
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);
}
View gist:6d0aa52ba73f56ff7d78
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)
View gist:6603a8e2be1ff2b53c2b
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 Aug 29, 2015
ScriptEd Music Assignment 3-17-2015
View scripted-music-3-17-2015.md

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