Skip to content

Instantly share code, notes, and snippets.

View delphinus's full-sized avatar

JINNOUCHI Yasushi delphinus

View GitHub Profile
@kuwaitbinary
kuwaitbinary / AutoPagerize-Safari.js
Last active September 9, 2023 15:16
AutoPagerize-Safari
This file has been truncated, but you can view the full file.
// ==UserScript==
// @name AutoPagerizes
// @description This is your new userscript, start writing code
// @match *://*.*
// ==/UserScript==
// AutoPagerize
// loading next page and inserting into current page.
// http://autopagerize.net/
@haccks
haccks / postfix_mail_macosx.md
Last active March 29, 2024 23:27
Send mail from local host using postfix on MacOS High Sierra.

Setting up postfix on MacOS High Sierra

MacOS Sierra High comes with preinstalled postfix. Follow these steps to configure it on a local system:

1. Create a sasl_passwd file

sudo nano /etc/postfix/sasl_passwd
  • Add this to the file
@retspen
retspen / pf_nat
Created March 2, 2018 18:27
Enable NAT on macOS
#!/bin/bash
cat > /usr/local/etc/pf-nat.conf << EOF
nat on en0 from vnic1:network to any -> (en0)
EOF
sudo pfctl -d
sudo sysctl -w net.inet.ip.forwarding=1
sudo pfctl -f /usr/local/etc/pf-nat.conf -e
@pudquick
pudquick / battery.py
Last active April 20, 2023 06:06
Accessing battery details via python and pyobjc on macOS / OS X
import objc
from Foundation import NSBundle
IOKit = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
functions = [("IOServiceGetMatchingService", b"II@"),
("IOServiceMatching", b"@*"),
("IORegistryEntryCreateCFProperties", b"IIo^@@I"),
("IOPSCopyPowerSourcesByType", b"@I"),
("IOPSCopyPowerSourcesInfo", b"@"),
@pocari
pocari / sample.vim
Last active January 2, 2020 17:03
Using lightline.vim prompt in Denite.nvim prompt
if exists('g:loaded_lightline')
" lightline.vim側で描画するのでdeniteでstatuslineを描画しないようにする
call denite#custom#option('default', 'statusline', v:false)
endif
" lightlineでmodeを描画する時ようのfunction
function! MyMode()
if &ft == 'denite'
" deniteは自分でinsertモード normalモードを管理しているので
" lightlineのハイライト関数をdeniteのモードに合わせた値(-- NORMAL -- ならn)
@krtx
krtx / imgcat
Created November 27, 2016 02:48
fix imgcat to be able to display images on tmux https://gitlab.com/gnachman/iterm2/issues/3898#note_14097715
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST.
function print_osc() {
if [[ -n $TERM ]] ; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"

マージ済みのリモートブランチを全て削除

git branch -r --merged master | grep -v -e master -e develop | sed -e 's% *origin/%%' | xargs -I% git push --delete origin %
  1. remote の master に merge済み の branch をすべて表示して
  2. master と develop は消えてほしくないので除外して
  3. origin/ を削除して
  4. xargs (-I% % で ブランチ名を渡しつつ、全て削除する)
@koemu
koemu / getswap.sh
Created December 18, 2013 01:09
各プロセスのスワップ使用量を調べる。 なお、root or sudo での実行が必要。 参照元: http://northernmost.org/blog/find-out-what-is-using-your-swap/
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Updated: 2013-11-13 Yuichiro Saito
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
@gsainio
gsainio / gist:6322375
Created August 23, 2013 18:20
Sample perl code to use service accounts and oauth2 with Google's Admin SDK API.
#!/usr/public/bin/perl -w
use strict;
use JSON;
use JSON::WebToken;
use LWP::UserAgent;
use HTML::Entities;
my $private_key_string = q[-----BEGIN PRIVATE KEY-----
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code