This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size = (10, 10) | |
imgs = imgs[:size[0] * size[1]].reshape(size[0], size[1], 28, 28) | |
result = np.vstack(tuple([np.hstack(tuple(img)) for img in imgs])) | |
imsave('a.png', result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy as np | |
import cv2 | |
def extract_region(img, region): | |
top_left = np.min(region, axis=0) | |
bottom_right = np.max(region, axis=0) | |
margin = 2 | |
region_of_image = img.copy()[top_left[1]-margin:bottom_right[1]+margin, top_left[0]-margin:bottom_right[0]+margin] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdftk a.pdf dump_data_utf8 output data.txt | |
vi data.txt | |
pdftk a.pdf update_info_utf8 data.txt output b.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pi(n): | |
half_pi = 0 | |
for k in range(n + 1): | |
m = 1.0 | |
for i in range(1, k + 1): | |
m *= float(2 * i - 1) / (2 * i) | |
half_pi += m / (2 * k + 1) | |
return 2 * half_pi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
package main | |
import ( | |
"fmt" | |
"go/scanner" | |
"os" | |
"go/token" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat app/models/comment.rb | ruby -r pp -r ripper -e 'pp Ripper.sexp(ARGF.read)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set filePath to "" | |
tell application "QuickTime Player" | |
try | |
if file path of front document is not equal to missing value then | |
set filePath to file path of front document | |
end if | |
end try | |
try | |
if path of front document is not equal to missing value then | |
set filePath to path of front document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`echo "#{CSV.generate(col_sep: "\t") {|r| a.to_a[1..-1].each{|ar| r << ar} }}" | pbcopy` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import glob | |
import MeCab | |
import gensim | |
from gensim import corpora, matutils | |
import numpy as np | |
import codecs | |
import sys | |
sys.stdout = codecs.getwriter('utf_8')(sys.stdout) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_GYAZO</name> | |
<url type="shell"> | |
<![CDATA[ /usr/sbin/screencapture /tmp/gyazo-fullscreen.png; /Applications/Gyazo.app/Contents/MacOS/Gyazo /tmp/gyazo-fullscreen.png ]]> | |
</url> | |
</vkopenurldef> | |
<list> |