Skip to content

Instantly share code, notes, and snippets.

View lagagain's full-sized avatar

lagagain lagagain

View GitHub Profile
@lagagain
lagagain / c-printf.lisp
Created December 11, 2018 11:51
[practice] [Common Lisp] CFFI - c-printf example (Common Lisp)
(require :cffi)
(defpackage my-example
(:use :cl :cffi))
(in-package my-example)
;; example: direct call
(foreign-funcall "printf" :string (format nil "%s: %d~%") ;; need change ~% to \0 in c.(end for string)
:string "Hello"
@lagagain
lagagain / Decorators.lisp
Last active December 11, 2018 12:50
自制@裝飾器
(defun Decorators (stream ch1)
(declare (ignore ch1))
(let ((Decorator (read stream))
(the-func-form (read stream)))
(unless (eq (first the-func-form) 'defun)
(error "need 'defun"))
(let ((the-func-name (second the-func-form))
(the-func-args (third the-func-form))
(the-func (cdddr the-func-form)))
;;; init-local.el -- load my config
;;; Commentary:
;;; load my config
;;; Code:
;;;
;;; load send-term
(load "../my-lisp/send-term/send-term.el")
@lagagain
lagagain / abcl.cl
Last active March 12, 2019 15:09
JAVA GUI / ABCL GUI
(defun main ()
(let* ((JFrame (jclass "javax.swing.JFrame"))
(JButton (jclass "javax.swing.JButton"))
(BorderLayout (jclass "java.awt.BorderLayout"))
(demo (jnew JFrame "Layout Demo"))
(east (jnew JButton "East"))
(south (jnew JButton "South"))
(west (jnew JButton "West"))
(north (jnew JButton "North"))
(center (jnew JButton "Center")))
#! /bin/bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
echo ${SCRIPTPATH}
if [ -d "${SCRIPTPATH}/bin" ] ; then
PATH="${SCRIPTPATH}/bin:$PATH"
fi
(in-package :cl-user)
(defpackage :testread
(:use cl))
(in-package :testread)
(defparameter *old-readtable* (copy-readtable) "")
(defparameter *new-readtable* (copy-readtable) "")
(defparameter *syms* (make-hash-table))
@lagagain
lagagain / test.py
Last active April 13, 2019 16:20
classmethod and staticmethod implement for python3.6
def myClassmethod(m, *arg, **karg):
def _m(cls, *arg, **karg):
cls = cls if isinstance(cls, type(int)) else cls.__class__
return m(cls, *arg, **karg)
return _m
def myStaticmethod(m, *arg, **karg):
def _m(*arg, **karg):
if len(arg) > 0:
if m.__name__ in dir(arg[0].__class__):
b0d1630... 04/14/19 13:31 public
+ d9aa1d7... 04/13/19 23:14 public classmethod and staticmethod implement for python3.6
+ d71a4fd... 04/12/19 09:33 public
c2c8790... 03/21/19 11:12 public
+ 648c7e1... 03/12/19 23:06 public JAVA GUI / ABCL GUI
4f0b15e... 02/21/19 09:49 public
5be04a4... 02/08/19 18:13 private
+ 2d30a57... 02/08/19 18:11 private EOSIO-contract eoshop
e1d8bdb... 12/11/18 20:40 public 自制@裝飾器
c145d35... 12/11/18 19:51 public [practice] [Common Lisp] CFFI - c-printf example (Common Lisp)
(require 'abcl-contrib)
(require 'abcl-asdf)
(require 'jss)
(defpackage id.lag.tesabcl
(:use cl abcl-contrib abcl-asdf jss java))
(in-package id.lag.tesabcl)
(jcall "println" #"java.lang.System.out" "Hello, World")
@lagagain
lagagain / LICENSE
Created May 7, 2019 14:03
A simple panter with HTML 5
Copyright (c) 2019, lagagain
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the