Skip to content

Instantly share code, notes, and snippets.

View BH1SCW's full-sized avatar

F.J Kong BH1SCW

View GitHub Profile
#!/bin/bash -u
thisCount=0
names=()
if [ $# -eq 1 ] ; then
data=`cut --delimiter=: --fields=5 ${1}`
all=`echo ${data} | cut --delimiter=' ' --fields=1`
for X in ${all} ; do
n = ((n >> 1) & 0x55555555) | ((n << 1) & 0xaaaaaaaa);
n = ((n >> 2) & 0x33333333) | ((n << 2) & 0xcccccccc);
n = ((n >> 4) & 0x0f0f0f0f) | ((n << 4) & 0xf0f0f0f0);
n = ((n >> 8) & 0x00ff00ff) | ((n << 8) & 0xff00ff00);
n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);
// -- C code which reverses the bits in a word
@BH1SCW
BH1SCW / mutt-grep
Created May 17, 2012 10:02 — forked from s5unty/mutt-grep
wrapper around [mu|recoll], the [mail|file] indexing/searching utility
#! /bin/sh -
# inspiration from: http://www.zsh.org/mla/users/2007/msg01187.html
# require a POSIX sh, on those systems where the POSIX sh is not in /bin
# (like Solaris), you may need to adapt the shebang line above
# (/usr/xpg4/bin/sh on Solaris). You also need a terminfo aware "tput",
# ncurses one (the default on most systems) will do.
# wrapper around mu, the mail indexing/searching utility for mutt.
# in your ~/.muttrc:
@BH1SCW
BH1SCW / install-gnu-sed-on-mac-osx.sh
Created February 20, 2020 03:26 — forked from jlrigau/install-gnu-sed-on-mac-osx.sh
How to install Gnu sed on Mac OS X
brew install --with-default-names gnu-sed

Git-Shadowsocks与git代理配置

# 设置配置

# Windows默认1080端口
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
@BH1SCW
BH1SCW / patch-edid.md
Created August 10, 2021 01:19 — forked from ejdyksen/patch-edid.md
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@BH1SCW
BH1SCW / mosh-agent-forwarding-ng.rb
Created August 21, 2021 06:36 — forked from snixon/mosh-agent-forwarding-ng.rb
Homebrew Formula: mosh with agent forwarding
require "formula"
class MobileShell < Formula
desc "Remote terminal application"
homepage "https://mosh.mit.edu/"
url "https://mosh.mit.edu/mosh-1.2.5.tar.gz"
sha256 "1af809e5d747c333a852fbf7acdbf4d354dc4bbc2839e3afe5cf798190074be3"
bottle do
sha256 "046b0c48cd1c573d57500e683122e3152a00556ad960938c6caa962b0c2ef460" => :el_capitan
@BH1SCW
BH1SCW / things-to-fantastical.applescript
Created September 2, 2021 07:03 — forked from IskenHuang/things-to-fantastical.applescript
Things3 complete todos create calendar event to fantastical.
(*
## Goal
This script is make new calendar event to fantastical2 from things3 complete todos in 'Logbook' on specified date.
## How to use:
* Default is today
* `$ osascript things-to-fantastical.applescript`
* The specified date
* `$ osascript things-to-fantastical.applescript 2017/08/12`
*)