Skip to content

Instantly share code, notes, and snippets.

View patorash's full-sized avatar
👓
I'm sleepy

patorash patorash

👓
I'm sleepy
View GitHub Profile
@toryano0820
toryano0820 / wsl2-ubuntu-map-win-localhost.sh
Last active May 11, 2024 03:32
For WSL2: Fixes "Connection Refused" issue when accessing Windows localhost services. Run with "sudo sh wsl2-ubuntu-map-win-localhost.sh" !!! Remember to backup "/etc/hosts" just in case !!!
nameserver=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}') # find nameserver
[ -n "$nameserver" ] || "unable to find nameserver" || exit 1 # exit immediately if nameserver was not found
echo "##### nameserver found: '$nameserver'"
localhost_entry=$(grep -v "127.0.0.1" /etc/hosts | grep "\slocalhost$") # find localhost entry excluding 127.0.0.1
if [ -n "$localhost_entry" ]; then # if localhost entry was found
echo "##### localhost entry found: '$localhost_entry'"
sed -i "s/$localhost_entry/$nameserver localhost/g" /etc/hosts # then update localhost entry with the new $nameserver
else # else if entry was not found
echo "##### localhost entry not found"
echo "$nameserver localhost" >> /etc/hosts # then append $nameserver mapping to localhost
@progfay
progfay / isucon10_qualify_manual.md
Last active July 3, 2022 23:18
ISUCON10 予選マニュアル

ISUCON10 予選マニュアル

かならず、 ISUCON10 予選レギュレーション も併せてご確認ください。レギュレーションの内容と本マニュアルの内容に矛盾がある場合、本マニュアルの内容が優先されます。

はじめに

スケジュール

(時刻はすべて JST)

@palkan
palkan / 01_Readme.md
Last active April 30, 2023 00:03
Backport Rails 6 per-environment credentials

Backport Rails 6 per-environment credentials to Rails 5.2

Rails PR: rails/rails#33521

This patch makes it possible to use per-environment credentials (i.e., config/credentials/staging.yml.enc) in Rails 5.2.

Installation

  • Drop backport_rails_six_credentials.rb and backport_rails_six_credentials_command.rb somewhere, for example, into the lib/ folder
  • Add this line to config/application.rb:
@shizone
shizone / okayama.md
Created February 14, 2019 04:36
岡山勉強会一覧
勉強会名 主催者・運営者 URL 直近一年での開催
Okayama.rb @ore_public
@mako_wis
https://okaruby.connpass.com あり
okayama-js @maepon https://okayama-js.connpass.com/ なし
岡山Javaユーザー会 @zephiransas
@razon
@ryosms
https://okajug.doorkeeper.jp あり
中国地方DB勉強会(岡山) @ikkitang
@razon
@mako_wis
https://dbstudychugoku.github.io/ あり
リーダブルな夜 @SawadaStdDesign
@maepon
@sakie_boondock
@mako_wis
https://readable-na.connpass.com あり
Okayama Managers Meeting @mao_instantlife https://omm.connpass.com あり
岡山Python勉強会 @yamayama_k5 https://okapython.connpass.com/ あり
JBUG岡山 @mao_instantlife https://jbug.connpass.com/ あり
@miz21358
miz21358 / template.json
Created January 16, 2018 06:35
Elasticsearch+kuromoji-neologd で品詞分解アナライザを設定したテンプレート設定用JSONファイル
{
"sample-analyze": {
"order": 0,
"template": "sample-analyze-*",
"settings": {
"index": {
"analysis": {
"filter": {
"greek_lowercase_filter": {
"type": "lowercase",
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@tkawa
tkawa / .rubocop.yml
Last active May 10, 2018 08:10
Rubocop settings
# cf.
# http://nttpc.now.tl/ac2014/?p=20#toc_4
# https://github.com/cookpad/styleguide/blob/master/ruby.ja.md
# https://gist.github.com/onk/38bfbd78899d892e0e83
# https://github.com/onk/onkcop/blob/master/config/rubocop.yml
AllCops:
DisplayCopNames: true
Exclude:
- db/schema.rb
@elcamino
elcamino / full-page-screenshots-selenium-chrome.rb
Last active February 1, 2024 21:41
How to take full-page screenshots with Selenium and Google Chrome in Ruby
#!/usr/bin/env ruby
require 'selenium-webdriver'
wd = Selenium::WebDriver.for :remote, url: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome
wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/'
# Get the actual page dimensions using javascript
#
width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);")
@Fishrock123
Fishrock123 / gulp.js
Last active August 1, 2021 11:19
gulp & browserify (+watchify +babelify)
var gulp = require('gulp')
var browserify = require('browserify')
var watchify = require('watchify')
var babelify = require('babelify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var merge = require('utils-merge')
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key