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
| #include <lua.h> | |
| #include <lauxlib.h> | |
| #ifdef _WIN32 | |
| #include <windows.h> | |
| #define EXPORT __declspec(dllexport) | |
| #else | |
| #include <sys/time.h> | |
| #include <unistd.h> | |
| #define EXPORT |
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
| diff --git a/src/openssl.c b/src/openssl.c | |
| index 99a1ec0..7dc19e2 100644 | |
| --- a/src/openssl.c | |
| +++ b/src/openssl.c | |
| @@ -2988,7 +2988,7 @@ static int xc_getVersion(lua_State *L) { | |
| static int xc_setVersion(lua_State *L) { | |
| X509 *crt = checksimple(L, 1, X509_CERT_CLASS); | |
| - int version = luaL_checkint(L, 2); | |
| + int version = luaL_checkinteger(L, 2); |
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 |
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
| 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
| 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
| {-# 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; | |
| 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
| 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
| #!/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 |