Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+107B: make the sound better + sync to animation #12

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
sudo: false
dist: trusty
language: c
install:
- git clone https://github.com/google/zopfli.git
- pushd zopfli; make && export PATH=$PATH:$PWD; popd
script:
- make server/index.html
- test $(stat -c'%s' server/index.html) -lt 1300
- s=$(stat -c%s server/index.html); echo $s; test $s -lt 1300
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
all: server/index.html server/cpkthttp

server/index.html: client/index.html
./utils/deflate.py client/index.html server/index.html
sed 's:^\s*\|\s*$\|/\*.*\*/::g' client/index.html | tr -d '\n' > server/index.html.stripped
zopfli --i1000 -c --deflate server/index.html.stripped > server/index.html
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evq will this run ok on the server?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not atm, but that's easily fixed

Copy link
Collaborator

@evq evq Sep 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas this should be good to go server side now (zopfli installed)


server/cpkthttp: server/c/main.c
gcc -O2 -o server/cpkthttp server/c/main.c
Expand Down
28 changes: 27 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
<title>best TCP packet</title><link id=l href=data:image/gif;base64,R0lGODlhHAAUAPMFACE5CDlaCHuMa+fn50J7ANaM//+MjP/WjIz///9r9/9rawAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQAFACwAAAAAHAAUAAADhFi6PAIQCkZre0GQJ6b9hQMIR3kY2gBWIkAcXReMK8VxGQapddidpJxGQ+CtNKbSJqb0gETJQ2ZZQhkt0KSQJM0cM9EAYcwdfrkmzKtkBmkMUcNMK7hWMFF20voFwPNJbRYyhGh5NFgzhoBpAHYFQ4ySXhcjkowPV3iXjJQKGDGhoqOCCQAh+QQJBQAEACwAAAEAGgATAAAEeJDIOaqoM+ttgxfXsI3SIHhIeoIimZmAkM4IELQuAa+158U4EkgW+5xsgODoRFvxWC5YMwCiIk7KF2halV0vJJN3RmXOwCMxrXY8oznms20MFQLW7ObQju87szx9eH8ZQ0iCelQ4Jl+BiFdAEnGPfWUETkOZmpsfEQAh+QQJBQAGACwAAAIAFwASAAADcmi6074wwiZqbTIPEYLtwpBNhCcUqBWOxhagXqEG4sidMgB2gDC6KFnBdKNpOEGYKueLVADJ4VJWcUKjRJw0MnhFi1oPVxvklLRVSCUK62Ct3iQSW2txrmw2p7Yx6+J5OSJda089ZFghLh48OjoqMwADCQAh+QQJBQAEACwBAAQAFwAQAAAEcpDISeW4uGo6hAhA6A1b1QFCoRafQJbEmcz0HAiwnNw7KL6aT8H2uRVdmwFvNmwVbxpdzenDVVq1GTUVAMY+WZrxVgB4neEeKFEGKgEJQbocYncnwrg87NEiPQFDNiAqaShfAIJMKlhZh28ekZE+RpM4EQAh+QQFBQAEACwBAAEAGgATAAAEeZDISSsZeNjNb+4gFgijIGgghZFAoLABmg4sKSi4LXO0iwO3gLC12/RwSFutqCIhkybYiWd65koBA1DAcVpfWFPL2PqCxb/ABmYeAtIWr89ag6vm1W8ZDLjPFX9tUxIDe0hDgYeDNDdmL41WIxcsjpU/GoWImpucJxEAOw== rel=icon><pre id=p></pre><a href='//candyjapan.com'>Sponsored by Candy Japan - Surprise Japanese candy boxes twice a month</a><img id=z>YOUR_120_BYTE_AD_HERE<img id=y><script>c=new AudioContext;n=setInterval("for(n+=7,i=k,P='\u25b2.\\n';i-=1/k;P+=P[i%2?(i%2*j-j+n/k^j)&1:2])j=k/i;p.innerHTML=P;with(c.createOscillator())frequency.value=200*(j+n/k^j),connect(c.destination),start(),stop(n/k)",k=64);z.src=y.src=l.href</script>
<title>best TCP packet</title>
<link id=l href=data:image/gif;base64,R0lGODlhHAAUAPMFACE5CDlaCHuMa+fn50J7ANaM//+MjP/WjIz///9r9/9rawAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQAFACwAAAAAHAAUAAADhFi6PAIQCkZre0GQJ6b9hQMIR3kY2gBWIkAcXReMK8VxGQapddidpJxGQ+CtNKbSJqb0gETJQ2ZZQhkt0KSQJM0cM9EAYcwdfrkmzKtkBmkMUcNMK7hWMFF20voFwPNJbRYyhGh5NFgzhoBpAHYFQ4ySXhcjkowPV3iXjJQKGDGhoqOCCQAh+QQJBQAEACwAAAEAGgATAAAEeJDIOaqoM+ttgxfXsI3SIHhIeoIimZmAkM4IELQuAa+158U4EkgW+5xsgODoRFvxWC5YMwCiIk7KF2halV0vJJN3RmXOwCMxrXY8oznms20MFQLW7ObQju87szx9eH8ZQ0iCelQ4Jl+BiFdAEnGPfWUETkOZmpsfEQAh+QQJBQAGACwAAAIAFwASAAADcmi6074wwiZqbTIPEYLtwpBNhCcUqBWOxhagXqEG4sidMgB2gDC6KFnBdKNpOEGYKueLVADJ4VJWcUKjRJw0MnhFi1oPVxvklLRVSCUK62Ct3iQSW2txrmw2p7Yx6+J5OSJda089ZFghLh48OjoqMwADCQAh+QQJBQAEACwBAAQAFwAQAAAEcpDISeW4uGo6hAhA6A1b1QFCoRafQJbEmcz0HAiwnNw7KL6aT8H2uRVdmwFvNmwVbxpdzenDVVq1GTUVAMY+WZrxVgB4neEeKFEGKgEJQbocYncnwrg87NEiPQFDNiAqaShfAIJMKlhZh28ekZE+RpM4EQAh+QQFBQAEACwBAAEAGgATAAAEeZDISSsZeNjNb+4gFgijIGgghZFAoLABmg4sKSi4LXO0iwO3gLC12/RwSFutqCIhkybYiWd65koBA1DAcVpfWFPL2PqCxb/ABmYeAtIWr89ag6vm1W8ZDLjPFX9tUxIDe0hDgYeDNDdmL41WIxcsjpU/GoWImpucJxEAOw== rel=icon>
<pre id=p></pre>
<a href='//candyjapan.com'>Sponsored by Candy Japan - Surprise Japanese candy boxes twice a month</a>
<img id=z>YOUR_120_BYTE_AD_HERE<img id=y>
<script>
z.src=y.src=l.href,
T=t=0,k=64,
c=new AudioContext(),
b=c.createScriptProcessor(2048,1,1),
b.connect(c.destination),
b.onaudioprocess=function(e){
d=e.outputBuffer.getChannelData(0);
for(i=0;
i<d.length;
i++,t=++T*32000/c.sampleRate/*simple resampler*/)
/* music by mu6k */
d[i]=(((3e3/(y=t&16383)&1)*35+
(x=t*'6689'[t>>16&3]/24&127)*y/4e4+
((t>>8^t>>10|t>>14|x)&63))&255)/128-1
for(n=t>>7,i=k,P='\u25b2.\n';
i-=1/k;
P+=P[i%2?(i%2*j-j+n/k^j)&1:2])
j=k/i;
p.innerText=P
}
</script>
25 changes: 0 additions & 25 deletions utils/deflate.py

This file was deleted.