Skip to content

Instantly share code, notes, and snippets.

@nyamakawa
nyamakawa / gist:5505e26acd889cd760573d3e447c9567
Created March 29, 2021 03:35
Force Password Authentication to connect SSH
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no
https://unix.stackexchange.com/questions/15138/how-to-force-ssh-client-to-use-only-password-auth
#!/usr/bin/perl -w
# Original : https://stackoverflow.com/a/38790442
use strict;
use Getopt::Std;
my ($tot,$mtot)=(0,0);
my %procs;
my %opts;
grep -rlZPi 'match1' | xargs -0r perl -pi -e 's/match2/replace/gi;'
select
table_name, engine, table_rows as tbl_rows, avg_row_length as rlen,
floor((data_length+index_length)/1024/1024) as allMB,
floor((data_length)/1024/1024) as dMB,
floor((index_length)/1024/1024) as iMB
from information_schema.tables
where table_schema=database()
order by (data_length+index_length) desc;
git log --no-merges origin/master..develop
@nyamakawa
nyamakawa / gist:d65e9d43ad557f3338c1537488b2c1d5
Last active December 11, 2018 23:03
remove lines contained 'abc'
sed '/abc/d' input.file
git ls-files -z | xargs -0 sed -i -e 's/foo/bar/g'
@nyamakawa
nyamakawa / README.md
Last active November 10, 2017 09:29 — forked from sevko/README.md
simple Python raytracer

raytracer

A simple Python raytracer that supports spheres with configurable "material" properties (base color and a bunch of light coefficients). To generate a raytraced image of the pre-defined scene, run: python raytracer.py and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres

acknowledgements

I found the following resources extremely helpful:

Separate image of text into component character images
ImageMagick
http://stackoverflow.com/questions/1972299/separate-image-of-text-into-component-character-images
認識情報を利用した英数字混在文書からの文字切出しと認識
https://www.jstage.jst.go.jp/article/ieejeiss1987/122/6/122_6_928/_pdf
;(global-unset-key "\M-\\")
;(define-key function-key-map "\M-\\" [?\\])
(define-key global-map [165] [92])
; perl config
(setq cperl-indent-parens-as-block t)
(setq cperl-indent-subs-specially nil)
(setq auto-mode-alist
(append '(("\\.\\([pP][Llm]\\|al\\|t\\|psgi\\)$" . cperl-mode))
# coding: utf-8
require 'logger'
require 'socket'
class TestServer
attr_reader :responder, :port, :server, :logger
def initialize(port, logger)
@port = port.to_i
@stop = false