-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1067 lines (652 loc) · 44.8 KB
/
index.html
File metadata and controls
1067 lines (652 loc) · 44.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="ja"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Moonwell</title>
<meta name="author" content="Moon">
<meta name="description" content="I need to recover the guest’kvm root password. I plan to boot into Single mode
to change the password at first. However, there is a much faster way …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://ohmynerd.github.io/">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Moonwell" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28435781-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body >
<div id="container">
<header role="banner"><hgroup>
<h1><a href="/">Moonwell</a></h1>
<h2>忘れないうちにメモ</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="https://www.google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:ohmynerd.github.io" />
<input class="search" type="text" name="sitesearch" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/02/23/reset-root-password-kvm-guest/">Reset Root Password Kvm Guest</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2015-02-23T18:12:03+09:00" pubdate data-updated="true">Feb 23<span>rd</span>, 2015</time> -</span>
| <a href="/blog/2015/02/23/reset-root-password-kvm-guest/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>I need to recover the guest’kvm root password. I plan to boot into Single mode
to change the password at first. However, there is a much faster way to do it.</p>
<ul>
<li>Shutdown the vm</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">virsh shutdown <span class="c">#{kvm_name}</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Mount the filesystem inside the image</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo kpartx -av /var/lib/libvirt/images/#<span class="o">{</span>kmv_file<span class="o">}</span>.img
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>
<p>The filesystem should be mounted as <code>/dev/mapper/loopX</code>, which actually (in my case)
is a link to <code>/dev/dm-X</code> (X is a number)</p>
</li>
<li>
<p>The last step is simple</p>
</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo mount /dev/dm-X /mnt
</span><span class="line">sudo vim /mnt/etc/shadow
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>find the line which contains your username, then change it like below, from</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">username:<span class="o">{</span><span class="c">#a_very_long_string}:16489:0:99999:7:::</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>to</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">username::16489:0:99999:7:::
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Reboot the kvm and you’re done</li>
</ul>
</div>
<footer>
- <a href="/blog/2015/02/23/reset-root-password-kvm-guest/">Reset root password kvm guest</a>
<time datetime="2015-02-23T18:12:03+09:00" pubdate><span class='month'>Feb</span> <span class='day'>23</span> <span class='year'>2015</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/07/15/go-go-away-trailing-spaces/">Go Go Away Trailing Spaces</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-07-15T15:05:21+09:00" pubdate data-updated="true">Jul 15<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/07/15/go-go-away-trailing-spaces/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Execute this</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="nb">export </span><span class="nv">LC_ALL</span><span class="o">=</span>C find . -not <span class="se">\(</span> -name .svn -prune -o -name .git -prune <span class="se">\)</span> -type f -print0 | xargs -0 sed -i <span class="s1">''</span> -E <span class="s2">"s/[[:space:]]*$//"</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>in which</p>
<pre><code> -name name -prune: Exclude named folder
-or: OR operation
-0: seperate by NULL
-E: no eof trailing
export LC_ALL=C: treat strings as if each byte were its own characters
</code></pre>
</div>
<footer>
- <a href="/blog/2014/07/15/go-go-away-trailing-spaces/">Go go away trailing spaces</a>
<time datetime="2014-07-15T15:05:21+09:00" pubdate><span class='month'>Jul</span> <span class='day'>15</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/06/09/im-a-mysql-noob/">I’m a MySQL Noob</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-06-09T13:05:50+09:00" pubdate data-updated="true">Jun 9<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/06/09/im-a-mysql-noob/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><ul>
<li>Install MySQL (Credit to http://www.macminivault.com/mysql-mavericks/)</li>
</ul>
<div><table class="CodeRay"><tr>
<td class="line-numbers"><pre><a href="#n1" name="n1">1</a>
</pre></td>
<td class="code"><pre>bash <(curl -Ls http://git.io/eUx7rg)
</pre></td>
</tr></table>
</div>
<ul>
<li>Change default root password</li>
</ul>
<div><table class="CodeRay"><tr>
<td class="line-numbers"><pre><a href="#n1" name="n1">1</a>
<a href="#n2" name="n2">2</a>
<a href="#n3" name="n3">3</a>
<a href="#n4" name="n4">4</a>
</pre></td>
<td class="code"><pre>mysql -u root -p
use mysql;
update user set password=PASSWORD("your_new_password") where user='root';
flush privileges;
</pre></td>
</tr></table>
</div>
<ul>
<li>Create new user</li>
</ul>
<div><table class="CodeRay"><tr>
<td class="line-numbers"><pre><a href="#n1" name="n1">1</a>
<a href="#n2" name="n2">2</a>
<a href="#n3" name="n3">3</a>
</pre></td>
<td class="code"><pre>create user <span class="string"><span class="delimiter">'</span><span class="content">username</span><span class="delimiter">'</span></span><span class="error">@</span><span class="string"><span class="delimiter">'</span><span class="content">localhost</span><span class="delimiter">'</span></span> identified by <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>;
grant <span class="predefined">all</span> privileges on *.* to <span class="string"><span class="delimiter">'</span><span class="content">username</span><span class="delimiter">'</span></span><span class="error">@</span><span class="string"><span class="delimiter">'</span><span class="content">localhost</span><span class="delimiter">'</span></span>;
flush privileges;
</pre></td>
</tr></table>
</div>
</div>
<footer>
- <a href="/blog/2014/06/09/im-a-mysql-noob/">I’m a MySQL noob</a>
<time datetime="2014-06-09T13:05:50+09:00" pubdate><span class='month'>Jun</span> <span class='day'>09</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/05/23/update-gitlab/">Update Gitlab</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-05-23T17:25:07+09:00" pubdate data-updated="true">May 23<span>rd</span>, 2014</time> -</span>
| <a href="/blog/2014/05/23/update-gitlab/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><h2 id="gitlab-update">Gitlab update</h2>
<p><strong>Last update: 2014/05/23 17:13 from 6.7 to 6.9-stable</strong></p>
<ul>
<li>Log in to git account</li>
<li>Backup</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="nb">cd</span> ~/gitlab
</span><span class="line"><span class="nv">RAILS_ENV</span><span class="o">=</span>production bundle <span class="nb">exec </span>rake gitlab:backup:create
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Stop server <code>su - _sudo_user_ -c "sudo service gitlab stop"</code></li>
<li>Get code</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="nb">cd</span> ~/gitlab
</span><span class="line">git fetch
</span><span class="line">git checkout _stable_branch_
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Update gitlab shell</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="nb">cd</span> ~/gitlab-shell
</span><span class="line">git fetch
</span><span class="line">git merge _some_version_ <span class="c"># need to merge to preserve local config</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Install gems, migrate</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="nb">cd</span> ~/gitlab
</span><span class="line">bundle install --without development <span class="nb">test </span>postgres --deployment
</span><span class="line">bundle <span class="nb">exec </span>rake db:migrate <span class="nv">RAILS_ENV</span><span class="o">=</span>production
</span><span class="line">bundle <span class="nb">exec </span>rake assets:precompile <span class="nv">RAILS_ENV</span><span class="o">=</span>production
</span></code></pre></td></tr></table></div></figure></notextile></div>
<ul>
<li>Restart services</li>
</ul>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">su - _sudo_user_ -c <span class="s2">"sudo service gitlab start"</span>
</span><span class="line">su - _sudo_user_ -c <span class="s2">"sudo /etc/init.d/nginx restart"</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
</div>
<footer>
- <a href="/blog/2014/05/23/update-gitlab/">Update Gitlab</a>
<time datetime="2014-05-23T17:25:07+09:00" pubdate><span class='month'>May</span> <span class='day'>23</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/04/11/passenger-standalone-in-development-mode/">Passenger Standalone in Development Mode</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-04-11T09:43:17+09:00" pubdate data-updated="true">Apr 11<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/04/11/passenger-standalone-in-development-mode/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Take from <code>http://www.modrails.com/documentation/Users%20guide%20Standalone.html#install_on_debian_ubuntu</code></p>
<p>Adding APT repository
Install PGP key. Packages are signed by “Phusion Automated Software Signing (auto-software-signing@phusion.nl)”, fingerprint 1637 8A33 A6EF 1676 2922 526E 561F 9B9C AC40 B2F7.</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Add HTTPS support for APT</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo apt-get install apt-transport-https ca-certificates
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Create a file /etc/apt/sources.list.d/passenger.list and insert one of the following lines, depending on your distribution.</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="c">##### !!!! Only add ONE of these lines, not all of them !!!! #####</span>
</span><span class="line"><span class="c"># Ubuntu 13.10</span>
</span><span class="line">deb https://oss-binaries.phusionpassenger.com/apt/passenger saucy main
</span><span class="line"><span class="c"># Ubuntu 12.04</span>
</span><span class="line">deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main
</span><span class="line"><span class="c"># Ubuntu 10.04</span>
</span><span class="line">deb https://oss-binaries.phusionpassenger.com/apt/passenger lucid main
</span><span class="line"><span class="c"># Debian 7</span>
</span><span class="line">deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main
</span><span class="line"><span class="c"># Debian 6</span>
</span><span class="line">deb https://oss-binaries.phusionpassenger.com/apt/passenger squeeze main
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Secure passenger.list and update your APT cache:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo chown root: /etc/apt/sources.list.d/passenger.list
</span><span class="line">sudo chmod 600 /etc/apt/sources.list.d/passenger.list
</span><span class="line">sudo apt-get update
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Install passenger</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo apt-get install passenger
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Run passenger in development mode</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">rvmsudo passenger start -a 0.0.0.0 -p 80 --max-pool-size 1 --spawn-method conservative -e development --user<span class="o">=</span>user_name
</span></code></pre></td></tr></table></div></figure></notextile></div>
</div>
<footer>
- <a href="/blog/2014/04/11/passenger-standalone-in-development-mode/">Passenger Standalone in development mode</a>
<time datetime="2014-04-11T09:43:17+09:00" pubdate><span class='month'>Apr</span> <span class='day'>11</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/04/09/sync-remote-folder/">Sync Remote Folder</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-04-09T09:47:56+09:00" pubdate data-updated="true">Apr 9<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/04/09/sync-remote-folder/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Sometimes I need to get a copy of remote folder</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">rsync -chavzP --stats -e <span class="s1">'ssh -p port_number'</span> user@ip:remote_folder local_folder
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>in which</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">-c: checksum
</span><span class="line">-h: human readable
</span><span class="line">-a: archive
</span><span class="line">-v: verbose
</span><span class="line">-z: compress
</span><span class="line">-P: partial copy
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>However, I prefer just mounting</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sshfs -p port_number user@ip:remote_folder local_folder
</span></code></pre></td></tr></table></div></figure></notextile></div>
</div>
<footer>
- <a href="/blog/2014/04/09/sync-remote-folder/">Sync remote folder</a>
<time datetime="2014-04-09T09:47:56+09:00" pubdate><span class='month'>Apr</span> <span class='day'>09</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/04/08/openssl-heartbleed-and-update-fixes/">OpenSSL Heartbleed & Update Fixes</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-04-08T10:06:45+09:00" pubdate data-updated="true">Apr 8<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/04/08/openssl-heartbleed-and-update-fixes/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Details here</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">http://heartbleed.com/
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>Update fix in Ubuntu 12.04</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo apt-get update
</span><span class="line">sudo apt-get upgrade
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>OSX</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">brew update
</span><span class="line">brew install openssl
</span></code></pre></td></tr></table></div></figure></notextile></div>
</div>
<footer>
- <a href="/blog/2014/04/08/openssl-heartbleed-and-update-fixes/">OpenSSL Heartbleed & update fixes</a>
<time datetime="2014-04-08T10:06:45+09:00" pubdate><span class='month'>Apr</span> <span class='day'>08</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/04/04/ubuntu-12-dot-04-plus-update-git/">Ubuntu 12.04 + Update Git</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-04-04T09:01:23+09:00" pubdate data-updated="true">Apr 4<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/04/04/ubuntu-12-dot-04-plus-update-git/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>メモしておく</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">sudo apt-get install -y software-properties-common python-software-properties
</span><span class="line">sudo add-apt-repository ppa:git-core/ppa
</span><span class="line">sudo apt-get update
</span><span class="line">sudo apt-get install git
</span></code></pre></td></tr></table></div></figure></notextile></div>
</div>
<footer>
- <a href="/blog/2014/04/04/ubuntu-12-dot-04-plus-update-git/">Ubuntu 12.04 + update git</a>
<time datetime="2014-04-04T09:01:23+09:00" pubdate><span class='month'>Apr</span> <span class='day'>04</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/03/25/vagrant-w-slash-nfs-and-passenger/">Vagrant w/NFS & Passenger</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-03-25T16:12:26+09:00" pubdate data-updated="true">Mar 25<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/03/25/vagrant-w-slash-nfs-and-passenger/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Today I got strange bug when trying to start a Rails app. Passenger keeps trying to say</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span>objdump nginx’s error log</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line"><span class="o">[</span> 2014-03-25 06:46:10.6957 931/7ff14a7a9700 Pool2/Implementation.cpp:883 <span class="o">]</span>: Could not spawn process <span class="k">for </span>group /vagrant/canvas#default: An error occurred <span class="k">while </span>starting up the preloader: it did not write a startup response in time.
</span><span class="line"> in <span class="s1">'void Passenger::ApplicationPool2::SmartSpawner::throwPreloaderSpawnException(const string&, Passenger::SpawnException::ErrorKind, Passenger::ApplicationPool2::Spawner::BackgroundIOCapturerPtr&, const DebugDirPtr&)'</span> <span class="o">(</span>SmartSpawner.h:146<span class="o">)</span>
</span><span class="line"> in <span class="s1">'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)'</span> <span class="o">(</span>SmartSpawner.h:566<span class="o">)</span>
</span><span class="line"> in <span class="s1">'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()'</span> <span class="o">(</span>SmartSpawner.h:206<span class="o">)</span>
</span><span class="line"> in <span class="s1">'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)'</span> <span class="o">(</span>SmartSpawner.h:752<span class="o">)</span>
</span><span class="line"> in <span class="s1">'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)'</span> <span class="o">(</span>Implementation.cpp:804<span class="o">)</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>after few tries without success, I were almost going to reinstall my vagrant box. Somehome I came up with the idea of trying to copy Rails app to home folder for the final try. Doing so, Passenger could start normally.
Wish that I find the gist below sooner.</p>
<blockquote><p>When using NFS with Vagrant all your files get mounted as the non-vagrant user. This isn’t a huge deal, unless you’re using Passenger for development. In that case because the files are not owned by the “vagrant” user, Passenger doesn’t know where the GEM_HOME should exist. You’ll most likely encounter errors such as Bundler::GitError asking you to run bundle install.</p><p>There’s several solutions out there that discuss setting the BUNDLE_PATH variable in “/vagrant/.bundle/config” but that doesn’t seem like an ideal solution. Please refer to nginx.conf file above.</p><footer><strong>Source:</strong> <cite><a href="https://gist.github.com/mhayes/1660958">gist.github.com/mhayes/1660958/…</a></cite></footer></blockquote>
<p>The important lines to note are:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span>nginx Passenger config for Rails app placed in ‘/vagrant’</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
</pre></td><td class="code"><pre><code class="bash"><span class="line">passenger_user_switching on;
</span><span class="line">passenger_user vagrant;
</span><span class="line">passenger_default_user vagrant;
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>This ensures that Passenger always runs as the “vagrant” user.</p>
</div>
<footer>
- <a href="/blog/2014/03/25/vagrant-w-slash-nfs-and-passenger/">vagrant w/NFS & Passenger</a>
<time datetime="2014-03-25T16:12:26+09:00" pubdate><span class='month'>Mar</span> <span class='day'>25</span> <span class='year'>2014</span></time>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/03/18/user-shaken/">User Shaken, It Isn’t That Scary</a></h1>
<div class="post-meta">
<p class="meta">
<span class="timestamp">-
<time datetime="2014-03-18T00:58:19+09:00" pubdate data-updated="true">Mar 18<span>th</span>, 2014</time> -</span>
| <a href="/blog/2014/03/18/user-shaken/#disqus_thread">Comments</a>
</p>
</div>
</header>
<div class="entry-content"><p>Shaken, 車検, hay hiểu nôm na là Kiểm định xe, là việc bắt buộc phải làm 2 năm 1 lần với xe cũ (đối với xe mới là 3 năm sau khi đăng ký, và từ đó 2 năm/lần).
Ấn tượng ban đầu của mình về vụ này là … cực kì phiền toái và tốn kém (giang hồ đồn). Tuy nhiên sau khi kinh qua thì mình thấy việc chuẩn bị cũng rất bình thường, và thay vì
vác xe ra dịch vụ, bạn hoàn toàn có thể tự làm và tiết kiệm kha khá tiền vào việc khác. Trong lúc vẫn còn nhớ mình tranh thủ ghi lại những gì đã trải qua để 2 năm nữa đặng còn dùng tiếp :v</p>
<h1 id="cc-giy-t-cn-chun-b">Các giấy tờ cần chuẩn bị</h1>
<ul>
<li>1 自動車検査証</li>
<li>2 自動車税納税証明書</li>
<li>3 <a href="http://annai-center.com/pdf/kirokubo.pdf">点検整備記録簿</a></li>
<li>4 自賠責保険(共済)証明書</li>
<li>5 自動車重量税納付書・印紙</li>
<li>6 継続検査申請書</li>
<li>7 自動車検査票・手数料納付書・印紙・証紙</li>
</ul>
<p>Trong tất cả các giấy tờ trên, số (1, 3) là nên chuẩn bị trước ở nhà, các giấy tờ còn lại có thể lấy hoặc mua ở Trung tâm kiểm định.</p>
<ol>
<li>
<h2 id="jidousha-kensashou">自動車検査証 (Jidousha kensashou)</h2>
<p>Giấy đăng ký xe, mặc định là có sẵn. Trên giấy ghi chủ xe, ngày tháng đăng ký xe, ngày hết Shaken, số thân xe, loại xe… Các thông tin trên kensashou là cực kì cần thiết để làm các giấy tờ khác.</p>
</li>
<li>
<h2 id="jidoushazei-nouzeishoumeisho">自動車税納税証明書 (Jidoushazei nouzeishoumeisho)</h2>
<p>Giấy chứng nhận nộp thuế xe, mua theo từng năm và hết hạn vào cuối tháng 5 mỗi năm. Giấy này lấy ở Máy tự động ở cạnh quầy nộp thuế tải trọng xe (ngay gần cửa ra vào)</p>
</li>
<li>
<h2 id="tenkenseibi-kirokubo">点検整備記録簿 (Tenkenseibi kirokubo)</h2>
<p>Bản ghi kết quả đánh giá kiểm tra xe (tự làm) gồm 60 mục. Kinh nghiệm của mình là ra cây xăng nào đó nhờ họ kiểm tra qua (miễn phí) vài thứ như ắc qui, dầu thắng, nước làm mát, nước rửa kính, chảy dầu, cân chỉnh lại áp suất hơi của lốp… Có thể đi qua 2, 3 tiệm để được double-check miễn phí :v Còn các mục khác cần kiểm tra, nếu bạn không biết thì nên tìm tới ai có tay nghề một chút nhờ xem hộ hoặc mang ra tiệm (mất tiền hoặc khá nhiều tiền :v). Trong trường hợp của mình vì trong quá trình đi xe chưa thấy hiện tượng lạ nên đánh dấu OK hết các mục đấy :v.</p>
</li>
<li>
<h2 id="jibaisekihoken-shoumeisho">自賠責保険(共済)証明書 (Jibaisekihoken shoumeisho)</h2>
<p>Giấy chứng nhận mua bảo hiểm bắt buộc. Tuỳ tải trọng & tuổi của xe mà số tiền sẽ khác nhau. Trong trường hợp xe mình là 27840 yen.</p>
</li>
<li>
<h2 id="jidousha-jyuuryouzei-noufusho">自動車重量税納付書・印紙 (Jidousha jyuuryouzei noufusho)</h2>
<p>Chứng nhận nộp thuế tải trọng xe. Mẫu lấy ở quầy làm User shaken, điền các thông tin và mua tem để dán ở quầy số 12. Xe mình mất 16000 yen.</p>
</li>
<li>
<h2 id="keizoku-kensashinseisho">継続検査申請書 (Keizoku kensashinseisho)</h2>
<p>Mẫu đăng ký làm mới Shaken. Mua ở quầy số 19 (giá 30 yen). Điền thông tin về xe bằng bút chì và thông tin về chủ sở hữu, người nộp đơn bằng bút bi.</p>
</li>
<li>
<h2 id="jidousha-kensahyou-tesuuryounoufusho">自動車検査票・手数料納付書・印紙・証紙 (Jidousha kensahyou tesuuryounoufusho)</h2>
<p>Mẫu kiểm tra, lấy ở quầy User shaken (miễn phí), sau đó mua tem ở quầy số 12 (nơi nộp thuế tải trọng), hết tất cả 1700 yen.</p>
</li>
</ol>
<h1 id="cc-bc-lm">Các bước làm</h1>
<ul>
<li>Kiểm tra xe</li>
<li><a href="https://www.yoyaku.navi.go.jp">Đăng ký kiểm tra tại Trung tâm</a>. Do 1 ngày có 4 round, sáng 2, chiều 2 nên tốt nhất nên đăng ký từ sáng, để nếu lỡ trượt thì đi làm lại luôn trong ngày được. Được phép đăng ký từ 14 ngày trước khi kiểm tra.</li>
<li>Chuẩn bị các giấy tờ cần thiết, chờ đến ngày thì đánh xe lên Trung tâm (北陸信越運輸局石川運輸支局総務企画部門 3 Chome-153 Irie Kanazawa, Ishikawa 921-8011)</li>
</ul>
<h1 id="thc-t">Thực tế</h1>
<p>Do lần đầu nên mình mất khá nhiều thời gian chuẩn bị các giấy tờ còn thiếu (gần 1 tiếng). Nếu có kinh nghiệm thì chắc chỉ mất 15p là xong. Giả sử đã có trong tay giấy số (1, 3) thì thứ tự các việc cần làm là:</p>
<ul>
<li>Ra quầy User shaken lấy mẫu số (2, 5, 7) và điền các thông tin cần thiết (theo mẫu hướng dẫn có sẵn). Chú ý là phải viết bằng tiếng Nhật.</li>
<li>Mua mẫu số 6 ở quầy 19</li>
<li>Mua bảo hiểm bắt buộc ở quầy đối diện quầy 19 (có ghi chữ 保険)</li>
<li>Sang quầy số 12 đóng thuế tải trọng, mua tem đăng ký 1700 yen.</li>
<li>Ra máy tự động lấy chứng nhận nộp thuế xe</li>
<li>Cuối cùng mang tất cả giấy tờ về nộp ở quầy User shaken. Tại đây họ sẽ kiểm tra và nếu các giấy tờ đã xong xuôi thì việc tiếp theo là đánh xe vào hàng chờ :P</li>
</ul>
<p>Thời gian chờ đợi để được vào kiểm tra khá lâu, mất khoảng 1 tiếng. Đang vẩn vơ suy nghĩ thì có một bác kiểm tra viên tới hỏi giấy tờ. Chắc thấy mặt ngu ngu nên được hỏi luôn câu “Lần đầu à?”, cũng có lẽ vì thế nên mình được hướng dẫn tận tình hơn. Đầu tiên là giai đoạn kiểm tra thủ công, họ sẽ mở capo, kiểm tra lốp, ốc, đèn sương mù, cốt, pha, xi nhan. Do thấy mình ngu ngơ quá (mà có lẽ ngu thật) nên các bạn kiểm tra viên làm hộ luôn các thao tác như kiểm tra còi :v Sau bước này là chuẩn bị vào kiểm tra bằng máy. Lần này bác kiểm tra viên cũng tận tình đi cùng luôn. Về cơ bản vào đây thấy hơi run tí, vì máy thì không du di như người roài. Thôi cứ nhắm mắt làm liều. Có thể tóm tắt cơ bản như sau:</p>
<ul>
<li>Kiểm tra đèn pha (hoặc cốt, do mình chọn)</li>
<li>Phanh tay (kéo hết cỡ, mạnh hơn bình thường vẫn làm tới … vài chục lần :v)</li>
<li>Tăng tốc tới 40km</li>
<li>Phanh chân</li>
</ul>
<p>Sau bước này là bước kiểm tra khí thải. Xuống xe đứng chờ. Tiếp theo lại lên xe, đánh vào vị trí để cho 1 kiểm tra viên kiểm tra gầm xe. Anh này sẽ yêu cầu mình đạp phanh chân, kéo phanh tay, đánh vô lăng. Do (may mắn) qua tất các test nên cuối cùng việc cần làm chỉ là (1) đánh xe dừng trước vạch (2) đem phiếu số 7 cho vào máy đọc bên tay phải (ngay gần đấy) (3) mang hồ sơ sang bốt bên trái để được đóng dấu. Vì cũng hồi hộp nên không để ý thời gian lắm, chắc mất tầm 20p tất cả. Sau khi ra khỏi line, mang giấy tờ về nộp ở quầy User Shaken và chờ nhận chứng nhận Shaken mới. Một cảm giác rất Yomost :v</p>
<h1 id="tng-kt">Tổng kết</h1>
<p>Toàn bộ thời gian từ lúc làm giấy tờ cho tới lúc kiểm tra xong là 3 tiếng. Tổng chi là ~47000 yen (thấp hơn kha khá so với sử dụng dịch vụ). Cái được lớn nhất là tìm hiểu thêm được vài thứ về xe và cảm giác Yomost khi đỗ :v Quả thật may mắn vì đang bận vãi đít mà có thể kết thúc một việc cần phải làm trong thời gian khá ngắn :))</p>
</div>
<footer>
- <a href="/blog/2014/03/18/user-shaken/">User shaken, it isn’t that scary</a>
<time datetime="2014-03-18T00:58:19+09:00" pubdate><span class='month'>Mar</span> <span class='day'>18</span> <span class='year'>2014</span></time>
</footer>
</article>
<div class="pagination">
<a href="/archives">Blog Archives</a>
</div><!-- /div.pagination -->
</div><!-- /div.blog-index -->
</div><!-- /div#content -->
</div><!-- /div#main -->
</div><!-- /div.container -->
<footer><div id="footer-widgets-wrapper">
<div id="footer-first" class="footer-widget">
<h3>About Me</h3>
<section class="about-me">
<div>
<ul>
<li>Blog: <a href="http://ohmynerd.github.io">http://ohmynerd.github.io</a></li>
</ul>
<p>
さまようの男
</p>
</div>
</section>
</div><!-- /div#footer-second -->
<div id="footer-second" class="footer-widget">
<h3>Recent Posts</h3>
<section id="hatena-popular" class="hatena-bookmark">
<script language="javascript" type="text/javascript" src="http://b.hatena.ne.jp/js/widget.js" charset="utf-8"></script>
<script language="javascript" type="text/javascript">
Hatena.BookmarkWidget.url = "http://ohmynerd.github.io";
Hatena.BookmarkWidget.title = "Recent Posts";
Hatena.BookmarkWidget.sort = "hot";
Hatena.BookmarkWidget.width = 0;
Hatena.BookmarkWidget.num = 10;
Hatena.BookmarkWidget.theme = "notheme";
Hatena.BookmarkWidget.load();
</script>
</section>
</div><!-- /div#footer-second -->
<div id="footer-third" class="footer-widget">
<h3>Popular Posts</h3>
<section id="hatena-popular" class="hatena-bookmark">
<script language="javascript" type="text/javascript" src="http://b.hatena.ne.jp/js/widget.js" charset="utf-8"></script>
<script language="javascript" type="text/javascript">
Hatena.BookmarkWidget.url = "http://ohmynerd.github.io";
Hatena.BookmarkWidget.title = "Popular Posts";