Submit Search
Upload
Quine
•
0 likes
•
173 views
R
R S
Follow
PORTもくもく会(#port_mokumoku)発表資料 Quineを作るために必要な知識
Read less
Read more
Technology
Report
Share
Report
Share
1 of 18
Download now
Download to read offline
Recommended
Everyones a publisher
Everyones a publisher
Wendy Stephens
Aprender wicca
Aprender wicca
silvanexx
Restaurantes mas raros del mundo
Restaurantes mas raros del mundo
fabiana flores hinojosa
historia de la computadora
historia de la computadora
Cristian Daniel Ruiz Cespedes
Everything You Need to Know about WordPress Themes
Everything You Need to Know about WordPress Themes
Tony Cecala, Ph.D.
The Voice Pick Code and Order Selection
The Voice Pick Code and Order Selection
Boreal Technologies
Tesis coremberg
Tesis coremberg
Adanel Montero Garcia
Frases de peliculas del itds
Frases de peliculas del itds
franco fernando yovhio soliz
Recommended
Everyones a publisher
Everyones a publisher
Wendy Stephens
Aprender wicca
Aprender wicca
silvanexx
Restaurantes mas raros del mundo
Restaurantes mas raros del mundo
fabiana flores hinojosa
historia de la computadora
historia de la computadora
Cristian Daniel Ruiz Cespedes
Everything You Need to Know about WordPress Themes
Everything You Need to Know about WordPress Themes
Tony Cecala, Ph.D.
The Voice Pick Code and Order Selection
The Voice Pick Code and Order Selection
Boreal Technologies
Tesis coremberg
Tesis coremberg
Adanel Montero Garcia
Frases de peliculas del itds
Frases de peliculas del itds
franco fernando yovhio soliz
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
FumieNakayama
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
Yuki Kikuchi
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
UEHARA, Tetsutaro
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
Hiroki Ichikura
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
akihisamiyanaga1
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
FumieNakayama
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
博三 太田
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
iPride Co., Ltd.
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
sugiuralab
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
More Related Content
Recently uploaded
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
FumieNakayama
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
Yuki Kikuchi
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
UEHARA, Tetsutaro
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
Hiroki Ichikura
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
akihisamiyanaga1
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
FumieNakayama
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
博三 太田
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
iPride Co., Ltd.
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
sugiuralab
Recently uploaded
(9)
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
Featured
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Featured
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Quine
1.
たのしい Quine入門 すずき ※画像と本文は関係ありません
2.
まずはこちらをご覧いただきたい
3.
$ cat quine1.rb eval s = "puts 'eval s = ' + s.dump” $ ruby quine1.rb eval s = "puts 'eval s = ' + s.dump"
4.
お分かりいただけただろうか
5.
「自分自身」と「実行結果」が等しいプログラム 由来: 論理学者 Willard van Orman Quine (1908-2000) Quine とは “Yields falsehood
when preceded by its quotation” yields falsehood when preceded by its quotation. 「という文は、自身の引用を頭につけると偽になる」 という文は、自身の引用を頭につけると偽になる。
6.
チャレンジ! > puts "myself" myself > puts "puts "..."" puts "myself" > ### ^ω^...
7.
変数を用意する > s = "..."; puts s ... > # 少なくとも最初と最後は決まったので > s = "s = "..."; puts s"; puts s s = "..."; puts s > # やはりこれもキリがない
8.
文字列自身で文字列を操作する > s = "s = "..."; puts s"; puts s.sub("...", s) s = "s = "..."; puts s"; puts s > # 最後が変わったので文字列の方も合わせる > s = "s = "..."; puts s.sub("...", s)"; puts s.sub("...", s) s = "s = "..."; puts s.sub("...", s)"; puts s.sub("...", s) > # 惜しい!
9.
特殊記号と戦う > # String#dump > puts "foo"bar".dump "foo"bar" > s = "s = "..."; puts s.sub("...", s.dump)"; puts s.sub("...", s.dump) s = ""s = "..."; puts s.sub("...", s.dump)""; puts s.sub("...", s.dump) > # This is Quine ?!
10.
Quine 3原則 1. 元となる文字列変数を使用 2.
文字列を自分自身で置き換える 3. 特殊記号と戦う
11.
特殊記号との戦い ver.Java public class
Quine { public static void main(String[] args) { String s = "public class Quine {%3$c%4$cpublic static void main (String[] args) {%3$c%4$c %4$cString s = %2$c%1$s%2$c;%3$c%4$c %4$cSystem.out.printf(s, s, 34, 10, 9);%3$c%4$c} %3$c}"; System.out.printf(s, s, 34, 10, 9); } } // http://blogs.adobe.com/charles/2011/01/my-adventure-writing-my-first-quine-in-java.html
12.
evalは神 eval を使うと簡潔に書ける 冒頭のコード
13.
dumpを使わない dumpは改行記号をnにしてしまい何かと不便 %(...) と q%(...): エスケープ不要 eval s = %q(puts %(eval s = %q(#{ s })))
14.
状態を持たせる quine_A.rb quine_B.rb 実行実行
15.
言語をまたぐ quine.rb quine.py 実行 (python)実行 (ruby)
16.
言語をまたぐ (補足) 34は " 、92は のASCIIコード s = '"hoge"'; s.gsub(34.chr, 92.chr<<34) # -> '"hoge"' 実は、大元となる言語(ruby)以外の知識は あまり必要ない(hello worldレベルでおk)
17.
驚きの実行方法 eval$e=%q(puts'open http://localhost:18463';require'socket' s=TCPServer.new 18463;c=(/GET +/(d*)/i=~c.gets;c<<%(HTTP /1.0 200 OKnContent-Type:text/htmlnn)+(eval(%(#$1% 60>0? %(leval$e=%q(#$e)#)[#$1,1].sub('&','&').sub('>','>' ).sub('<','<'):'<br>'# ;nil))||%(<title>quine web server </title>The source code of this web server is:<pre id='p'> </pre><script type='text/javascript'>a=i=0;f=function(){a!= 0&&a.readyState<4||(a!=0&&(document.getElementById('p').in nerHTML+=a.responseText),i++<719&&(a=new XMLHttpRequest() , a.open('GET','/'+i,true),a.onreadystatechange=f,a.send()))} ;f() </script>));puts$_;c.shutdown:WR;c.read;c.close)while c=s.accept ## quine-web-server.rb (c) Yusuke Endoh 2009 #)#
18.
出展 「あなたの知らない超絶技巧プログラミングの世界」 遠藤侑介 著、技術評論社、2015 GitHub - mame / trance-book https://github.com/mame/trance-book My Adventure Writing My First Quine in Java http://blogs.adobe.com/charles/2011/01/my-adventure-writing-my-first-quine-in-java.html
Download now