This file contains hidden or 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
#!/usr/bin/env lua | |
-- Awoo Tool by @wolfiestyle | |
-- license: MIT/X11 | |
-- demo: https://twitter.com/wolfiestyle/status/767124329461084161 | |
local lgi = require "lgi" | |
local Gtk = lgi.Gtk | |
local GLib = lgi.GLib | |
local window = Gtk.Window{ | |
title = "awoo tool v0.1-alpha", |
This file contains hidden or 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
// the OOP version in C++ | |
#include <iostream> | |
// base abstract class. that is what we use as the interface | |
class Animal | |
{ | |
public: | |
Animal(char const* name): m_name(name) {} | |
// this is required to properly delete virtual classes |
This file contains hidden or 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
#!/usr/bin/env python2 | |
# based on the code from: https://github.com/google/deepdream | |
import argparse | |
parser = argparse.ArgumentParser(description='Deep dreams an image.') | |
parser.add_argument('image', type=open, help='image file to process') | |
parser.add_argument('-g', '--gpu', action='store_true', help='enable GPU acceleration') | |
parser.add_argument('-o', '--out', type=argparse.FileType('w'), default='out.png', help='output image file') | |
args = parser.parse_args() | |
from cStringIO import StringIO |
This file contains hidden or 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
set $p = L->ci | |
while ($p > L->base_ci ) | |
if ( $p->func->value.gc->cl.c.isC == 1 ) | |
printf "0x%x C FUNCTION ", $p | |
output $p->func->value.gc->cl.c.f | |
printf "\n" | |
else | |
if ($p->func.tt==6) | |
set $proto = $p->func->value.gc->cl.l.p | |
set $filename = (char*)(&($proto->source->tsv) + 1) |
This file contains hidden or 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
extern crate num; | |
extern crate nalgebra as na; | |
use std::io::{self, Write}; | |
use std::fs::File; | |
use std::f64::consts; | |
use num::complex::Complex64; | |
use num::{Zero, One}; | |
use na::{Vec2, Vec3, Mat3, Dot, Cross, Norm}; |
This file contains hidden or 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
{-# LANGUAGE BangPatterns #-} | |
import Control.Applicative | |
import System.IO | |
import Data.Maybe | |
import Data.Complex | |
import Data.Word | |
import qualified Data.ByteString as B | |
data Vec a = Vec { vecx, vecy, vecz :: !a } |
This file contains hidden or 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
extern crate num; | |
use num::complex::Complex64; | |
use num::traits::{Zero, One}; | |
use std::env; | |
use std::io::{self, Write}; | |
use std::fs::File; | |
fn viewport(width: usize, height: usize, size: f64, center: Complex64) -> (f64, f64, f64, f64) | |
{ | |
let (w, h, s) = (width as f64, height as f64, size * 0.5); |
This file contains hidden or 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
import Data.Complex | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C | |
viewport :: RealFloat a => Int -> Int -> a -> Complex a -> (Complex a, Complex a) | |
viewport width height size center = (p0, p1 - p0) | |
where s = size * 0.5 | |
(w, h) = (fromIntegral width, fromIntegral height) | |
dist = if w > h then (s :+ s * h / w) else (s * w / h :+ s) | |
(p0, p1) = (center - dist, center + dist) |
This file contains hidden or 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
template<class T>struct W{T v;W(T v):v(v){}}; template<class T>int f(T x){f(W<T>(x));} main(){f(0);} |
This file contains hidden or 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
#!/usr/bin/env lua | |
local eval | |
local global = { | |
["+"] = function(args) | |
local acc = 0 | |
for i = 1, #args do | |
acc = acc + args[i] | |
end | |
return acc |