Shammer's Philosophy

My private adversaria

2015-01-01から1年間の記事一覧

string-output-streamをサーバーで使ってみる

format や prin1 で文字列を受け取る - Shammerismで、make-string-output-streamを使ったときの結果を書いたが、これを TCP の Server の中で使ってみたい。 受信した文字を標準出力に書き出すだけのサーバーは以下のようになるが、 (with-open-socket (ser…

Using typecase in Common Lisp

I wrote some functions that need to check the type of valuable with using cond with numberp, stringp, characterp etc, here is a sample. (cond ((numberp x) ; do something here ...) ((stringp x) ; do something here ...) (t ...)) But, there i…

My python2 pocket reference - 20151214

This is updated version of python2 pocket reference from http://d.hatena.ne.jp/shammer/20151212/p1. Added substring from some index to last. Conditions There is no syntax like switch, case, cond. Only if-elif-else is available. >>> X = 100…

My python2 pocket reference - 20151212

This is a first version of python2 pocket reference. Conditions There is no syntax like switch, case, cond. Only if-elif-else is available. >>> X = 100 >>> if X == 10: ... print 'X is 10' ... elif X == 20: ... print 'X is 20' ... else: ...…

How to open multiple wireshark window on Mac?

Mac

There are a lot of cases that I want to open multi wireshark window to see multiple packets at the same time. But, there is no option to open multiple window on Dock Icon. For example, we can open multiple Finder window by clicking with Ct…

Bash Shell Script my pocket reference - 20151206

Updated from Bash Shell Script my pocket reference - 20150923 - Shammerism. Added the way how to use array on bash. if 文 sample if basic if [ $# -ne 1 ];then echo "Usage: $0 [123]"; exit 1; fi if [ $1 -eq 1 ];then echo "You are number#1."…

Outlook forgets YahooMail password

Mac

I use Microsoft Outlook 2011 on my Mac, but sometimes popped up the password request window even if the password is saved in my keychain and Outlook can access it. The answer is described in the following site.Fix Outlook 2011 forgetting p…

It takes several minutes to launch Emacs

In my test environment, it takes several minutes to launch Emacs because Emacs trying following command but can't connect in this environment for security reasons. /usr/bin/wget -q --spider www.emacswiki.orgEnabling http-proxy for wget mak…

read-line-with-message on Lisp

There are a lot of cases that waiting user input from STDIN after show some messages. Terminal output likes below on that case. What your name?: Waiting user input can be done with read or read-line on Lisp, but we have to use other functi…

Lisp selective box ver 20151124?

どのように呼べばいいかわからないのでこういうタイトルにしてみた。何らかの入力を伴うプログラムで、無効な値が入力された際には有効な値が入力されるまで繰り返し入力を促したい、という場合がある。全て網羅するのは大変なので、手始めに項番と項目のペ…

I begin to use Debian Jessie instead of Mac

I saw jessie's package list and know that Emacs installed by apt-get is 24.4 uim-skk supports sticky shift on Jessie I give importance those points. I have struggled to install uim-skk supported sticky-shift on wheezy, but I couldn't do it…

Karabiner Configuration Memo ver 20151116

Mac

My private.xml <root> <list> <item> <name>Disable all settings when using Emacs</name> <identifier>private.emacs_passthrough</identifier> <appendix>(Using __PassThrough__ and only)</appendix> <only>EMACS</only> <autogen>__PassThrough__</autogen> </item> <item> <name>Disable all…</name></item></list></root>

Both 0 and 1 are not integer on Lisp?

I found a wonder point on Lisp. Comparing a valuable type returned unexpected result. This unexpected thing happened when comparing the type of 1 and 2. I expected the type of them is equal. But this is not correct. ? (equal (type-of 1) (t…

Read string from STDIN on shell

There is a command line tool whose name is read. This enables to read a string from STDIN. This requires several aruguments, and those arguments are used to save strings from STDIN. This is a sample. echo "What is ticket name?"; read NAME;…

Debian 7.9 installed into Lenovo X1 Carbon

I installed Debian wheezy 7.4 into my laptop and wrote the article, Lenovo X1 Carbon へ wheezy 7.4 をインストール - Shammerism. At that time, wifi firmware is located at the USB memory root directory. But, this location seems to be changed…

Is this lisp function invoked on an interpreter or run as compiled program?

I have thought that there are any lisp standard function to judge whether this is running as an compiled program or running as an script on interpreter, this is in this article. Although I have never looked for a such kind of function earn…

Create a sequence list with Lisp

This is like a seq of shell command which is used like below. $ for i in `seq 1 10`;do echo $i;done 1 2 3 4 5 6 7 8 9 10 $Here is a lisp code. (defun seq (start end) (declare (integer start) (integer end)) (loop for i from start to end col…

16進数を2進数で表示させる

C

C言語で2進数を表示させる・改 - Shammerismで言及した関数を書いた。 #include <stdio.h> #include <stdlib.h> #include <string.h> void print_as_b_value(const long value){ unsigned long bit = (1L << (sizeof(long) * 8 - 1)); int i = 0; int x = 0; for( ; bit != 0 ; bit >>= 1,</string.h></stdlib.h></stdio.h>…

C言語で2進数を表示させる・改

C

C言語で2進数を表示させる - Shammerismの内容を少し変更。左の0は表示させないようにしたのと、引数をlong型に変更。 void print_as_b_value(const long value){ unsigned long bit = (1L << (sizeof(long) * 8 - 1)); int i = 0; int x = 0; for( ; bit !=…

16進数を10進数に戻す関数

C

16進数を10進数に戻す関数-20130202 - Shammerismでも同じタイトルの記事を書いた。以前はLispで書いたが、今回はC言語。文字列の反転 - Shammerismで作成したreverse_stringも使用する。 void hex_to_decimal(char *value){ int i = 0; int n; int base = 1…

文字列の反転

C

文字列を反転させる標準関数を見つけることができなかったので自作。 char* reverse_string(char* value){ if ( strlen(value) < 2 ) { return value; } else { char *result = malloc(strlen(value) - 1); int i, j; for( i = 0, j = strlen(value) - 1 ; i …

C言語で2進数を表示させる

C

Cで書かれたコードの中には、よくシフト演算や論理演算を使用するものがある。しかし、Cにそんなに強くない自分としてはそのようなコードを読んでも理解が難しい。そこで、サンプルのコードを2進数で見てみれば理解しやすくなるのではないか、と考えてprintf…

Automate the operation started from ssh login

I would like to automate the CLI operation started from ssh login. This may be a useful if you would like to repeat the similar command. This can be come true with sshpass. Here is a sample. for i in `seq 1 10`;do (echo "somecommand 1";ech…

Install Clozure CL 1.10 to Debian wheezy

I installed Clozure CL 1.9 to Debian wheezy before, detail is Install ClozureCL to Debian - Shammerism, but Clozure CL 1.10 already released. And then, I tried it but it couldn't be launched with following error. root@my-wheezy:/usr/local/…

ファイル名一括変換スクリプト

大量ファイル一括編集スクリプト - Shammerismでは、ファイルの中身を一括で書き変えるスクリプトを書いたが、ファイル名を書き変えるスクリプト。 if [ -e targets ];then rm targets; fi ls -l $1 | awk '{print $9}' > targets; while read file do mv $f…

Bash Shell Script my pocket reference - 20150923

Bash Shell Script Collection - 20150512 - ShammerismとBash Shell Script my pocket reference - 20150910 - Shammerismをマージ。 if 文 sample if basic if [ $# -ne 1 ];then echo "Usage: $0 [123]"; exit 1; fi if [ $1 -eq 1 ];then echo "You are …

How to break from loop in Common Lisp?

Description I found the link in Stack Overflow discussed about this. The link is Return from a nested loop in Common Lisp - Stack Overflow. This is an continuous article of 【LISP繰り返し Hack 】do を展開してみる・その2 - Shammerism. This…

Adding subjectAltName in openssl

SSL

I have been looking for the way how to generate CSR included subjectAltName. This is a supplemental article for X509証明書項目-対象者代替名称(subjectAlternativeName) - Shammerism. enable(remove comment character) the line "req_extensions =…

Bash Shell Script my pocket reference - 20150910

Bash Shell Script my pocket reference - 20150221 - Shammerismの内容に、ファイルの存在を確認する方法を追加。 if 文 sample if basic if [ $# -ne 1 ];then echo "Usage: $0 [123]"; exit 1; fi if [ $1 -eq 1 ];then echo "You are number#1."; elif […

Yahoo mail trouble

I use Yahoo Mail, but I couldn't receive emails to my yahoo mail a couple day ago. But, I can send email from this account. Yahoo rejects receiving email for my Yahoo Mail address with following error. Remote host said: 554 delivery error:…