Skip to content

Instantly share code, notes, and snippets.

View greymd's full-sized avatar
😉
Nanchatte

Yasuhiro Yamada greymd

😉
Nanchatte
View GitHub Profile
@doraTeX
doraTeX / ocr.sh
Last active April 19, 2024 13:04
A shell script to perform OCR on images/PDFs using macOS built-in OCR engine
#!/bin/bash
SCRIPTNAME=$(basename "$0")
function realpath () {
f=$@;
if [ -d "$f" ]; then
base="";
dir="$f";
else
base="/$(basename "$f")";
@GINK03
GINK03 / 食べログEDA.md
Last active October 22, 2019 05:17
食べログEDA

食べログEDA

3.6点の壁は本当にあるのか

スクレイピングのコード

import os
import sys
@maprangzth
maprangzth / iptables
Created November 28, 2017 13:27 — forked from m4ce/iptables
Transparent proxy with Squid and IPTables
# Rules for transparent proxying
iptables -N NO_PROXY -t nat
iptables -A NO_PROXY -t nat -d 0.0.0.0/8 -j ACCEPT
iptables -A NO_PROXY -t nat -d 10.0.0.0/8 -j ACCEPT
iptables -A NO_PROXY -t nat -d 127.0.0.0/8 -j ACCEPT
iptables -A NO_PROXY -t nat -d 169.254.0.0/16 -j ACCEPT
iptables -A NO_PROXY -t nat -d 172.16.0.0/12 -j ACCEPT
iptables -A NO_PROXY -t nat -d 192.168.0.0/16 -j ACCEPT
iptables -A NO_PROXY -t nat -d 224.0.0.0/4 -j ACCEPT
iptables -A NO_PROXY -t nat -d 240.0.0.0/4 -j ACCEPT
@NoraCodes
NoraCodes / work_queue.rs
Last active February 21, 2024 15:27
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@mikkun
mikkun / BannerGei.txt
Created July 1, 2017 14:24
「第29回シェル芸勉強会 大阪サテライト LT」で使用したスライドのような何か("history -r BannerGei.txt"で読み込んで下さい)
center(){ printf "%*s\n" $(((${#1}+$(tput cols))/2)) "$1"; };tput reset;printf "<?xml?><svg><text font-size='20'>帰ってきたバナー芸"|convert - pbm:-|pbmtoascii;printf "<?xml?><svg><text font-size='20'> +手書きSVG"|convert - pbm:-|pbmtoascii;center 'KUSANAGI Mitsuhisa(@mikkun_jp) 2017年7月1日';center '第29回シェル芸勉強会';center '大阪サテライトLT大会'
tput reset;printf "<?xml?><svg><text font-size='20'>1. 流れる「toilet」"|convert - pbm:-|pbmtoascii
A=$(printf "<?xml?><svg><text font-size='40'>うんこ💩|"|convert - pbm:-|pbmtoascii|sed 's/[^ ]\+$//');:(){ clear;echo "$A";A=$(echo "$A"|sed -r 's/(.)(.*)/\2\1/');sleep .03;:;};:
tput reset;printf "<?xml?><svg><text font-size='20'>2. 回転寿司"|convert - pbm:-|pbmtoascii
D=0;while :;do echo "<?xml?><svg xmlns:xlink='http://www.w3.org/1999/xlink'><rect x='0' y='0' height='90' width='90' style='fill:none;stroke:black'/><path id='C' d='m60,45 a15,15 0 1 1 -30,0 15,15 0 1 1 30,0 z' style='fill:none;stroke:none'/><text transform='rotate($D,45,45)' font-family='IPA明朝' style='font-size:30px;fill:black'><textPath xlin
@kuwa72
kuwa72 / lg.zsh
Created March 31, 2017 03:46
Life game(requirements: zsh, egzact. Tested on OSX).
#!/usr/bin/env zsh
FO=$(cat)
X=$(head -n 1 <<<$FO)
YL=$(echo $FO|wc -l|bc)
FF=$((echo $X|tr 1 0;echo $FO;echo $X|tr 1 0)|addl 0\ |addr \ 0)
for L in {1..$YL};do
for C in {1..$(echo $X|awk '{print NF}')}; do
echo $FF | sed -n $L,$((L+2))p | cut -d \ -f $C,$((C+1)),$((C+2)) | xargs | {
read B
if echo $B | grep -q '. . . . 1 . . . .';then
@Neetless
Neetless / mail.go
Last active February 28, 2017 07:59
SMTP mail transfer sample program for gmail and office365.
package main
import (
"bytes"
"errors"
"fmt"
"html/template"
"log"
"net"
"net/mail"
@ryotako
ryotako / addb.fish
Last active January 22, 2017 08:35
fishのビルトインコマンドだけでegzactを書く練習
function addb
while read -l line
echo $line
end
if count $argv >/dev/null
echo $argv[1]
end
end
@mecab
mecab / send-region-to-clipboard.el
Last active July 22, 2017 17:16
Send region to the clipboard via the xterm clipboard integration (PASTE64/OSC52)
(defun send-region-to-clipboard (START END)
;; Place https://github.com/skaji/remote-pbcopy-iterm2/blob/master/pbcopy as `cpbcopy`
(interactive "r")
(let ((infile (make-temp-file "send-region-to-clipboard")))
(write-region (buffer-substring (region-beginning) (region-end))
nil
infile
nil
'nomsg)
(with-temp-buffer
@stefanbuck
stefanbuck / upload-github-release-asset.sh
Last active November 26, 2023 12:40
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner