Skip to content

Instantly share code, notes, and snippets.

View kybr's full-sized avatar

karl yerkes kybr

  • University of California
  • Goleta, California
View GitHub Profile
# Karl's solution from "translation"
#
# Write a Python program
import random
# to guess a (random) number between 1 and 100.
secret = random.randint(1,100)
howmany = 0
@kybr
kybr / -
Created January 26, 2017 20:19
ix $ git status ~/Projects/MAT201B/mat201b2017 (master)
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
ix $ ~/Projects/MAT201B/mat201b2017 (master)
ix $ ~/Projects/MAT201B/mat201b2017 (master)
ix $ ~/Projects/MAT201B/mat201b2017 (master)
ix $ ~/Projects/MAT201B/mat201b2017 (master)
ix $ ~/Projects/MAT201B/mat201b2017 (master)
ix $ cd student/mert.toka/ ~/Projects/MAT201B/mat201b2017 (master)
@kybr
kybr / test_float.p6
Last active July 11, 2017 00:43
Is this a bad idea?
#!/usr/bin/env perl6
use v6.c;
# see https://en.wikipedia.org/wiki/Single-precision_floating-point_format
sub float(Buf $b) returns Rat {
my Int $i = $b[3]+<24 +| $b[2]+<16 +| $b[1]+<8 +| $b[0];
my Int $sign-bit = ($i +& 0b10000000_00000000_00000000_00000000) +> 31;
my Int $exponent = ($i +& 0b01111111_10000000_00000000_00000000) +> 23;
my Int $fraction = ($i +& 0b00000000_01111111_11111111_11111111);
my $thing = ((-1)**$sign-bit) * (1 + $fraction / (2**23)) * (2**($exponent - 127));
@kybr
kybr / zef-install-errors.txt
Last active July 24, 2017 15:14
`zef install --force Net::OSC` has errors
ix $ zef install --force Net::OSC ~ (master)
===> Searching for: Net::OSC
===> Testing: Net::OSC:ver('0.2.0')
===SORRY!=== Error while compiling /Users/*****/.zef/store/Net-OSC.git/0fce4750f4721f7ac54d8b8484d7be0806d3374d/lib/Net/OSC/Bundle.pm6 (Net::OSC::Bundle)
Undeclared routines:
pack-uint32 used at line 68
unpack-uint32 used at line 74
t/OSC/Bundle.t ...... Dubious, test returned 1
No subtests run
Script started on Tue Sep 12 11:33:03 2017
]1337;RemoteHost=ky@ix]1337;CurrentDir=/Users/ky/Projects/cuttlebone/openpgm/openpgm/pgm]1337;ShellIntegrationVersion=5;shell=fish]1337;RemoteHost=ky@ix]1337;CurrentDir=/Users/ky/Projects/cuttlebone/openpgm/openpgm/pgm]0;fish /Users/ky/Projects/cuttlebone/openpgm/openpgm/pgm(B[?2004h]0;fish /Users/ky/Projects/cuttlebone/openpgm/openpgm/pgm(B⏎(B ⏎ ]133;D;0]133;Aix $ ]133;B~/Projects/cuttlebone/openpgm/openpgm/pgm(B (master)  s~/Projects/cuttlebone/openpgm/openpgm/pgm(B (master)  ~/Projects/cuttlebone/openpgm/openpgm/pgm(B (master)  s(B~/Projects/cuttlebone/openpgm/openpgm/pgm(B (master)  cript(B~/Proj
@kybr
kybr / build.txt
Created September 12, 2017 18:40
Build OpenPGM w/ scons on macOS 10.13 Beta
scons: warning: BuildDir() and the build_dir keyword have been deprecated;
use VariantDir() and the variant_dir keyword instead.
File "/Users/ky/Projects/cuttlebone/openpgm/openpgm/pgm/SConstruct", line 237, in <module>
warning: unknown warning option '-Wunsafe-loop-optimizations'; did you mean '-Wunavailable-declarations'? [-Wunknown-warning-option]
In file included from checksum.c:40:
In file included from include/impl/framework.h:30:
In file included from include/pgm/atomic.h:46:
include/pgm/types.h:96:10: warning: keyword is hidden by macro definition [-Wkeyword-macro]
# define restrict
@kybr
kybr / -
Created October 17, 2017 22:35
RUN SCRIPT: Building file alloGLV/examples/appGUI.cpp.
Allosystem: GLV Library NOT found. Not building alloGLV.
Alloaudio: Gamma not found. Not building Alloaudio.
Cuttlebone required to build AlloSphere. Not found!
Using AlloSystem Run facilties.
----Building /tmp/AlloSystem/alloGLV/examples/appGUI.cpp
Not building GAMMA and no usable GAMMA binary found. Not linking application to GAMMA
Not building GLV and no usable GLV binary found. Not linking application to GLV
Not building Cuttlebone and no usable Cuttlebone binary found. Not linking application to Cuttlebone
Not building alloGLV and no usable alloGLV binary found. Not linking application to alloGLV
#!/bin/bash
if [ $# == 0 ]; then
echo "pass file to run"
echo "ex) ./run.sh src/main.cpp"
exit 1
fi
INITIALDIR=${PWD} # gives absolute path
# echo "Script executed from: ${INITIALDIR}"
#include "allocore/io/al_App.hpp"
using namespace al;
using namespace std;
struct MyApp : App, osc::PacketHandler {
MyApp() {
initWindow();
initAudio();
// I listen on 60777
oscRecv().open(60777, "", 0.016, Socket::UDP);
#include <iostream>
#include <vector>
using namespace std;
struct Grain {
vector<float> data;
unsigned size;
void setGrain(unsigned start, unsigned end, vector<float>& sound,
vector<float>& window) {
size = end - start;