Skip to content

Instantly share code, notes, and snippets.

View ajaxsys's full-sized avatar
🎯
Focusing

Andy Fang ajaxsys

🎯
Focusing
  • Yokohama, Japan
View GitHub Profile
@ajaxsys
ajaxsys / hack_web21_export_csv.js
Created February 18, 2022 16:50
Web21デビュー版のCSVダウンロードのbookmarklet (consoleで貼り付けて実行可)
(function() {
function formatYYYYMM(dt) {
var y = dt.getFullYear();
var m = ('00' + (dt.getMonth()+1)).slice(-2);
var d = ('00' + dt.getDate()).slice(-2);
return (y + m);
}
function getUpperLinePrice(txt) {
@ajaxsys
ajaxsys / certbot-auto
Created November 20, 2020 05:25
AWS EC2 support Let's encript certbot auto, download it and `sudo /usr/bin/certbot-auto --nginx`
#!/bin/sh
#
# Download and run the latest release version of the Certbot client.
#
# NOTE: THIS SCRIPT IS AUTO-GENERATED AND SELF-UPDATING
#
# IF YOU WANT TO EDIT IT LOCALLY, *ALWAYS* RUN YOUR COPY WITH THE
# "--no-self-upgrade" FLAG
#
# IF YOU WANT TO SEND PULL REQUESTS, THE REAL SOURCE FOR THIS FILE IS
@ajaxsys
ajaxsys / windows下,操作zip版postgres常用命令
Last active May 15, 2019 02:53
zip_postgres_usefule_cmd.cmd
REM windows下,操作zip版postgres常用命令。参数的意义请参照官方文档
REM zip版postgres下载地址:https://www.enterprisedb.com/download-postgresql-binaries
REM 设置为postgres zip版本解压缩路径<path_to_pgsql>
set PG_HOME=<path_to_pgsql>
cd %PG_HOME%
REM 自定义数据库保存文件夹
mkdir data
@ajaxsys
ajaxsys / gist:174a8af6e1a8f67bb6a39b22f45811a5
Created October 10, 2018 04:29 — forked from sebsto/gist:19b99f1fa1f32cae5d00
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@ajaxsys
ajaxsys / ngx-scanner-center-scan-patch.js
Created September 5, 2018 07:16
Patch for ngx scanner, only center areas are valid for scanning.
// Patch for node_modules/@zxing/ngx-scanner/esm5/zxing-ngx-scanner.js
BrowserCodeReader.prototype.createBinaryBitmap = function (mediaElement) {
if (undefined === this.canvasElementContext) {
this.prepareCaptureCanvas();
}
this.canvasElementContext.drawImage(mediaElement, 0, 0);
// FIXME byHo
// var luminanceSource = new HTMLCanvasElementLuminanceSource(this.canvasElement);
// var hybridBinarizer = new HybridBinarizer(luminanceSource);
// return new BinaryBitmap(hybridBinarizer);
@ajaxsys
ajaxsys / fix maven https error.txt
Created July 20, 2018 04:21
Just add this config to mirrors tag at %USER_PROFILE%\.m2\setting.xml
<mirror>
<id>central-no-ssl</id>
<name>Central without ssl</name>
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
# packstack --allinone --provision-demo=n --os-neutron-ovs-bridge-mappings=extnet:br-ex --os-neutron-ovs-bridge-interfaces=br-ex:em1 --os-neutron-ml2-type-drivers=vxlan,flat
/etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
TYPE=OVSPort
DEVICETYPE=ovs
BOOTPROTO=none
ONBOOT=yes
BOOTPROTO=none
DNS1=8.8.8.8
@ajaxsys
ajaxsys / sprintdatajpa.md
Created July 25, 2016 17:42 — forked from ryo-murai/sprintdatajpa.md
Spring DATA JPA概要

Spring DATA JPA

はじめに

  • Spring DATA JPAは、Spring Frameworkの拡張ライブラリ。springframework-jdbcシリーズか springframework-ormシリーズのようだが、安定したら本流に組み込まれるのかもしれない。
  • この記事の執筆時点のバージョンは SPRING DATA JPA 1.1.0 GA
  • Spring DATA JPAは、JPAの機能をベースに 汎用的な Repositoryの機能を提供する。
  • ちなみに、Repositoryというのは、ドメイン駆動設計(Domain Driven Design)のパターンのひとつで、ドメインのEntityのCollectionのように振舞う責務を持つ。例えば CustomerRepositoryならば、システムに存在するCustomer EntityたちをCollectionに保持するかのように振舞う。
  • PoEAAにもある。参照
  • もちろん本当のCollectionに保持したら大変なことになるので、バックエンドではデータベースアクセスが行われたりするわけだが、そういったことを抽象化する。
@ajaxsys
ajaxsys / dd.log
Created May 11, 2016 09:49 — forked from ktheory/dd.log
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
@ajaxsys
ajaxsys / osx-mongodb-rlimits-fix.md
Created November 23, 2015 13:06 — forked from tamitutor/osx-mongodb-rlimits-fix.md
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing: