Skip to content

Instantly share code, notes, and snippets.

// jsonnet -S -V depth=5 hanoi.jsonnet >/tmp/hanoi.html && open /tmp/hanoi.html
local depth = std.parseInt(std.extVar('depth'));
local rect(width, height, column) = [
'rect',
{
width: width * 40,
height: 40,
x: (column + 1) * 300 - width * 20,
@ericfode
ericfode / index.html
Created May 6, 2020 03:56
JS Audio Visualizer
<div id="content">
<input type="file" id="thefile" accept="audio/*" />
<canvas id="canvas"></canvas>
<audio id="audio" controls></audio>
</div>
@ericfode
ericfode / pytorch-on-circleci.yml
Created October 21, 2019 16:45
yaml snippet for building pytorch.
build-pytorch:
machine:
image: windows-server-2019-nvidia:edge
steps:
- run:
name: Download cudnn
command: |
$output = "cudnn.zip"
$url = "https://storage.googleapis.com/circleci-image-file/cudnn-10.1-windows10-x64-v7.6.4.38.zip" #
(New-Object System.Net.WebClient).DownloadFile($url, $output)
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c3f78752a68a0c3f62efb3332cceea0c8a1f04f7cf6b46e00ec0c3000bc8483e'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
<?php while (have_posts()) : the_post(); ?>
<?php $image=get_post_meta($post->ID, $key, true); ?>
<?php $video=get_post_meta($post->ID, $vkey, true); ?>
<?php $gallery=true; ?>
<?php if ($image!=="") { ?>
<?php $gallerydisplayed=true; $pcount++; ?>
<?php if ($pcount==1) { $portfolio_row_end=false; ?>
<div class="categoryportfoliowrap">
At /home/eric/src/globe/src/globe/events.clj:44:
Consider using:
(when-not (< (e-tic event) (:tic world)) event)
instead of:
(if (< (e-tic event) (:tic world)) nil event)
At /home/eric/src/globe/src/globe/events.clj:68:
Consider using:
(neg? amount)
instead of:
@ericfode
ericfode / gist:7761994
Last active December 30, 2015 02:19
New version... It works now
require 'anemone'
Anemone.crawl("http://localhost:3000") do |a|
a.on_every_page do |page|
puts "#{page.code}, #{page.links}, #{page.url}"
end
end
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
configure:2096: $? = 0
configure:2103: gcc -m32 -v >&5
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
configure:2106: $? = 0
configure:2113: gcc -m32 -V >&5
gcc: '-V' must come at the start of the command line
Sentinel::Command.new(/incidents/, "Lists all of the incidents that Sentinel knows about") do |matches, message|
opts = {
service_id: Sentinel::DB[:room_services]
.join(:rooms, :id => :room_id)
.where(rooms__room_id: message.room_id)
.select(:service_id)
}
records = Sentinel::DB[:incidents].where(opts).order(created_at)
loop records do |record|
message.say Yajil::Encoder.encode(record)