Skip to content

Instantly share code, notes, and snippets.

View machupicchubeta's full-sized avatar

machupicchubeta machupicchubeta

View GitHub Profile
@machupicchubeta
machupicchubeta / install-pam_tid-and-pam_reattach.sh
Created February 23, 2020 06:58 — forked from kawaz/install-pam_tid-and-pam_reattach.sh
sudo で TouchID が使えるようにする。tmux 内で使えるようにもする。
#!/bin/bash
set -e
set -o pipefail
# sudoでTouchIDが使えるようにする
if ! grep -Eq '^auth\s.*\spam_tid\.so$' /etc/pam.d/sudo; then
( set -e; set -o pipefail
# 最初の auth として pam_tid.so を追加
pam_sudo=$(awk 'fixed||!/^auth /{print} !fixed&&/^auth/{print "auth sufficient pam_tid.so";print;fixed=1}' /etc/pam.d/sudo)
sudo tee /etc/pam.d/sudo <<<"$pam_sudo"
@machupicchubeta
machupicchubeta / gist:baad864d7750a2afbce9
Created March 31, 2015 02:17
replace_line_feed_with_csv
cat "a_file_to_be_converted" | perl -ne '/^([\w]+)\n$/; print "\x27$1\x27, ";' > converted.csv
@machupicchubeta
machupicchubeta / liquibase_create_diff_changelog_command
Last active August 29, 2015 14:00
liquibase create __diff__ changelog command
liquibase --url=jdbc:postgresql://<hostname or ip>/<database name> --username=machupicchubeta --driver=org.postgresql.Driver --classpath=/Users/machupicchubeta/bin/postgresql-9.3-1101.jdbc41.jar --defaultSchemaName=public diffChangeLog --referenceUrl=jdbc:postgresql://<hostname or ip>/<reference database name> --referenceUsername=machupicchubeta > `date +"%Y%m%d%H%M%S"`_alter_public_tables.xml
@machupicchubeta
machupicchubeta / liquibase_create_changelog_command_using_properties
Created April 8, 2014 08:58
liquibase create changelog command using properties
liquibase --defaultSchemaName=public generateChangeLog > `date +"%Y%m%d%H%M%S"`_create_public_tables.xml
@machupicchubeta
machupicchubeta / convert_snakecase_to_camelcase_in_c#
Created April 7, 2014 07:32
convert snake case to camel case in c#
"foo_bar".Split(new [] {"_"}, StringSplitOptions.RemoveEmptyEntries).Select(s => char.ToUpperInvariant(s[0]) + s.Substring(1, s.Length - 1)).Aggregate(string.Empty, (s1, s2) => s1 + s2);
@machupicchubeta
machupicchubeta / liquibase_create_changelog_command
Created April 7, 2014 00:43
liquibase create changelog command
liquibase --url=jdbc:postgresql://<hostname or ip>/<database name> --username=machupicchubeta --driver=org.postgresql.Driver --classpath=/Users/machupicchubeta/bin/postgresql-9.3-1101.jdbc41.jar --defaultSchemaName=public generateChangeLog > `date +"%Y%m%d%H%M%S"`_create_public_tables.xml
@machupicchubeta
machupicchubeta / liquibase_migrate_command
Last active August 29, 2015 13:58
liquibase migrate command
liquibase --url=jdbc:postgresql://<hostname or ip>/<database name> --username=machupicchubeta --driver=org.postgresql.Driver --classpath=/Users/machupicchubeta/bin/postgresql-9.3-1101.jdbc41.jar --defaultSchemaName=public --changeLogFile=20140404184159_create_public_tables.xml migrate (or update)
@machupicchubeta
machupicchubeta / object_browser_startup_command_for_windows_when_an_error_occurs_oci_dll
Created April 3, 2014 02:06
the command to start the object-browser in windows when an error occurs that can not read the oci.dll
set PATH=<ODAC x86 edition installed directory>;%PATH%
cd "<object-browser installed directory>"
start <object-browser exe file>
@machupicchubeta
machupicchubeta / sqlplus_startup_command_for_mac
Created April 3, 2014 01:58
sqlplus startup command for mac
env DYLD_LIBRARY_PATH=<oracle instant client directory> NLS_LANG=AMERICAN_AMERICA.UTF8 sqlplus <username>/<password>@<host>/<schema>
@machupicchubeta
machupicchubeta / string_array_map!_to_integer_array
Created March 23, 2014 11:44
string array map! to integer array
@books = Book.find %w(2, 5, 10).map! &:to_i