- Find
4096
divided by4
. - Write a program that
- takes a number from the command line and divides it by 4.
- solves a thing called "FizzBuzz" up to the number 20. (hint: to get the remainder of a division, you need a thing called the modulo operator)
- takes a number and runs through the steps of the Collatz conjecture.
- takes a number, or numbers, and applies a formula that's actually useful to them. (if you're stuck for ideas, the quadratic formula could be interesting)
- takes a list of numbers and adds them together. (hint: first use a for loop, then look at
map
from https://docs.python.org/2/tutorial/datastructures.html#functional-programming-tools)
- takes a list of names and outputs something like
Hello Ted, John, Alice, and Jane!
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name J/K through Google results | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Stretchkennedy | |
// @match https://www.google.com/search?* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)" | |
FILES="$(find "$DIR"/src -type f -name '*.js' -not -name '*.test.js')" | |
IS_OLDER=false | |
for f in $FILES; do | |
if [[ "$f" -nt bundle.js ]]; then | |
echo "$f is newer than bundle.js" | |
IS_OLDER=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const schema = { | |
view: { | |
selectedUser: null | |
}, | |
data: { | |
users: { | |
$id: ({ id }, state, path) => fetch(`/api/users/${id}`).then(res => res.json()) | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Turbolinks.scroll = {} | |
document.addEventListener('click', function(e) { | |
var el = e.target; | |
if (el.getAttribute('data-turbolinks-scroll') !== 'false') return; | |
Turbolinks.scroll.top = window.scrollY || document.documentElement.scrollTop || document.documentElement.scrollTop; | |
}); | |
document.addEventListener('turbolinks:load', function() { | |
if (Turbolinks.scroll.top) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash one-liner to run a simple (and possibly non-compliant) http server | |
ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\n\r\n<html><body><h1>Test page</h1></body></html>"' | |
# more comprehensive version that sets Content-Type and Content-Length | |
CONTENT='<html><body><h1>Test page</h1></body></html>'; ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: '${#CONTENT}'\r\n\r\n'$CONTENT'"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<!-- This file was created with the aha Ansi HTML Adapter. http://ziz.delphigl.com/tool_aha.php --> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" /> | |
<title>stdin</title> | |
</head> | |
<body style="color:white; background-color:black"> | |
<pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function escape_chars { | |
sed 's/"/""/g' | |
} | |
function format { | |
date=$(git log -n1 --pretty=format:%cD "$1" | escape_chars) | |
author=$(git log -n1 --pretty=format:'%aN <%aE>' "$1" | escape_chars) | |
sha=$(git log -n1 --pretty=format:%h "$1" | escape_chars) | |
message=$(git log -n1 --pretty=format:%B "$1" | escape_chars) | |
echo "\"$date\",\"$author\",\"$sha\",\"$message\"" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mycommand { | |
sleep 1 | |
} | |
PIDS=() | |
for i in $(seq 1 10); do | |
mycommand & PIDS+=($(echo $! | sed 's/^\[[0-9]*\]//')); | |
done | |
wait ${PIDS[*]} |
NewerOlder