Skip to content

Instantly share code, notes, and snippets.

(define evens-only*&co
(lambda (l col)
(cond
[(null? l) (col '() 1 0)]
[(atom? (car l))
(cond
[(not (even? (car l)))
(evens-only*&co (cdr l)
(lambda (newlat E U)
(col newlat E (+ U (car l)))))]
@cosmez
cosmez / constansts.rkt
Created June 27, 2013 23:01 — forked from soegaard/constansts.rkt
Hack to declare constants
#lang racket
(module constants racket
(provide e pi)
(define e 2.1718281828)
(define pi (* 355/113 1.0)))
(require 'constants)
pi
; (set! pi (+ pi 1))
#lang racket
;; The racket/draw libraries provide imperative drawing functions.
;; http://docs.racket-lang.org/draw/index.html
(require racket/draw)
;; To create an image with width and height, use the make-bitmap
;; function.
;; For example, let's make a small image here:
@cosmez
cosmez / gist:9f58c03b719210ce65e8
Last active April 5, 2017 17:33
Racket Public FFI Examples
taglib https://github.com/takikawa/taglib-racket/blob/master/taglib/taglib.rkt
libsdl http://planet.racket-lang.org/package-source/pb82/sdl4racket.plt/1/1/src/
allegro https://github.com/kazzmir/racket-allegro-5/blob/master/allegro.rkt
libgit2 https://github.com/jarnaldich/racket-git/blob/master/libgit2.rkt
opencl http://planet.racket-lang.org/package-source/jaymccarthy/opencl.plt/3/4/c/
openmpi http://planet.racket-lang.org/package-source/jaymccarthy/openmpi.plt/1/1/ffi/
zeroqm http://planet.racket-lang.org/package-source/jaymccarthy/zeromq.plt/2/1/zmq.rkt
svn http://planet.racket-lang.org/package-source/jaymccarthy/svn-prop.plt/1/0/main.ss
chipmunk http://planet.racket-lang.org/package-source/jaymccarthy/chipmunk.plt/1/0/chipmunk-ffi.ss
opencv https://github.com/oetr/racket-opencv
@cosmez
cosmez / autogenerate.rkt
Created September 28, 2015 07:34
Auto Generate Java Models and Routes Code
#lang racket
(require db)
(define package-text "conviasc.db")
(define connection (mysql-connect #:user "root" #:database "colegio" #:password "admin"))
(define str string-append)
;class template, requires class name and fields
(define class-template (str "package " package-text ";\n\npublic class ~a {\n ~a}"))
;1.- Route, 2.- Table Name ,3.- Class Name,
(define route-all-template "get(\"/db/~a\", RouteHelper.dbRouteAll(\"~a\", ~a.class), new JsonTransformer());\n")
@cosmez
cosmez / Form1.cs
Created January 21, 2016 03:19
Form Con Parametro Extra
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ParametroExtra
@cosmez
cosmez / timer.html
Created October 28, 2016 03:37
Como generar un timer con cuenta regresiva
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.2/moment.min.js"></script>
<title>pruebs</title>
</head>
<body>
<div id="resultado">
</div>
@cosmez
cosmez / huffman.rkt
Created April 13, 2018 23:42
Huffman Encoding
#lang racket/base
(require racket/list)
(require racket/match)
;; LEAFS HERE
;; a leaf is a simple tagged list with the symbol 'leaf
;; as its first element, the second is the symbol and the
;; third is the weight
@cosmez
cosmez / day08.rkt
Created May 6, 2018 07:36
Day 8: I Heard You Like Registers
#lang racket/base
(require (for-syntax syntax/parse racket/base))
(require syntax/strip-context racket/port racket/string)
(provide
interp
read-syntax
#%app #%datum #%top #%top-interaction
module+ print-results
#%module-begin
@cosmez
cosmez / Pdfium_SDL2.cs
Created October 18, 2023 04:59
PdfiumCore + SDL2 in C#
/** packages to install
<ItemGroup>
<PackageReference Include="PDFiumCore" Version="120.0.6056" />
<PackageReference Include="ppy.SDL2-CS" Version="1.0.82" />
</ItemGroup>
*/
using PDFiumCore;
using static SDL2.SDL;