Skip to content

Instantly share code, notes, and snippets.

@samm81
samm81 / Rainbow Prompt
Last active December 20, 2015 11:59
Bash character code to make a rainbow prompt
\[\e[1;41m\] \[\e[1;42m\] \[\e[1;43m\] \[\e[1;44m\] \[\e[1;45m\] \[\e[1;46m\] \[\e[1;41m\] \[\e[1;42m\] \[\e[1;43m\] \[\e[1;44m\] \[\e[1;45m\] \[\e[1;46m\] \[\e[0m\]
@samm81
samm81 / Mega Prompt
Last active December 20, 2015 11:59
Bash characters to make a mega prompt
\[\e[1;35m\][$(uptime)]\n\[\e[1;33m\][\d \@]\[\e[0;32m\][tty\l]\[\e[1;34m\][\s \V]\[\e[0;35m\][\[\e[0;36m\]\u\[\e[0;35m\]@\[\e[0;36m\]\H\[\e[0;35m\]]\[\e[1;31m\][\w]\n\[\e[1;34m\][$LANG]\[\e[1;35m\][Jobs: \j]\[\e[0;35m\][From $SSH_CONNECTION]\n\[\e[1;31m\](!\!) \[\e[1;37m\]\$\[\e[1;37m\]
@samm81
samm81 / survive8th.tru
Created February 14, 2014 00:28
Surviving 8th Grade
!Sam Maynard
!Comp Sci Final Project
!Period 1
!Wu
RANDOMIZE
!###################INTRODUCTION AND SETUP#########################
PRINT "Welcome to Surviving 8th Grade"
@samm81
samm81 / Wave.java
Created February 14, 2014 00:29
Wave
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.Random;
import javax.swing.JFrame;
@samm81
samm81 / eclipse-format-prefs.xml
Last active February 1, 2024 12:33
eclipse-format-prefs
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="mine" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<html>
<body onload="go(1, true, 0)">
<div style="text-align:center; padding-top:200px; font-size:40px; line-height:80px;">
<div id="timer"></div>
<div id="exercise"></div>
</div>
</body>
<script>
var exercises = ["Preparing", "Running in Place", "Resting (Jumping Jacks Next)", "Jumping Jacks", "Resting (Jumping Squats Next)", "Jumping Squats", "Resting (Push Ups Next)", "Push Ups", "Resting (Bicycle Crunch Next)", "Bicycle Crunch", "Resting (Burpees Next)", "Burpees", "Resting (Mason Twist Next)", "Mason Twist", "Resting (Mountain Climbers Next)", "Mountain Climbers", "All Done!"];
@samm81
samm81 / whatshouldireadnext.com checker
Created February 22, 2015 22:59
Checks all the books on http://www.whatshouldireadnext.com/ when you're asking for a recommendation.
$(".checkbox > input").each(function () {this.checked=true;});
@samm81
samm81 / brickpop.py
Last active September 16, 2017 23:58
An automatic solver for facebook messenger's brickpop game. The code is a mess. Don't judge.
import pyautogui # this will require some packages or something to be installed
import time
cmap = { (253, 178, 54): 'y', (255, 109, 114): 'r', (14, 177, 156): 'g', (79, 150, 242): 'b', (179, 111, 238): 'p', (151, 136, 116): 'l', (247, 239, 228): '0', (20, 179, 158) : 'g' }
hgap = 49
vgap = 49
xo, yo = pyautogui.position()
def getColor(x, y, s):
@samm81
samm81 / add_new_cards.py
Last active September 15, 2017 23:46
Simple script to create an anki importable csv for new chinese flash cards.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import html
import requests
import sys
import readline
# curl 'http://www.yellowbridge.com/chinese/dictionary.php' -H 'Cookie: PHPSESSID=qijdue2gmrhs4pltdphjcqj3o2; _ga=GA1.2.112204757.1484656688; _gid=GA1.2.125872261.1495576784' -H 'Origin: http://www.yellowbridge.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://www.yellowbridge.com/chinese/dictionary.php' -H 'Connection: keep-alive' -H 'DNT: 1' --data 'searchMode=P&word=shen2me' --compressed
headers = {
@samm81
samm81 / emoji.elm
Created September 3, 2017 23:12
an old abandoned elm project where emoji run around on the page
module Main exposing (..)
import Html exposing (Html)
import Html.App as Html
import Html.Attributes exposing (style)
import Time exposing (fps, every, second)
import Signal exposing (Signal)
import Random exposing (Generator, Seed, initialSeed, int, float, generate)
import List exposing (head, tail)
import Graphics.Element exposing (Element, show)