Skip to content

Instantly share code, notes, and snippets.

@yalab
yalab / sprockets-extend.rb
Created April 7, 2018 09:29
User definition sprockets function
module Sprockets::SassProcessor::Functions
def cdn_path(path, options={})
prefix = if (asset_host = Rails.application.config.action_controller.asset_host)
asset_host.scan(%r(/[^/]+\Z)).first
else
""
end
prefixed = prefix + asset_path(path, options).to_s
Sass::Script::String.new(prefixed)
end
wpa_passphrase SSID
# => write your WIFI PASSWORD then show encoded password
iwconfig wlan0 essid SSID enc s:ENCODED_PASSWORD
(defun rb-strkeytosym (start end)
"ruby Hash key string to symbol"
(interactive "r")
(replace-regexp "\"\\([a-z_]+\\)\"=>" "\\1: " nil start end))
(defun rb-htmlopttoerb (start end)
"html attreibute to erb option"
(interactive "r")
(replace-regexp " \\([a-z_]+\\)=" ", \\1: " nil start end))
@yalab
yalab / post-checkout
Created January 14, 2018 05:43
ブランチを切り替えて Gemfile.lock や yarn.lock に変更があったら勝手に install する git hook
#!/bin/bash
PREV=$1
POST=$2
TRUE="1"
FALSE="0"
isChanged (){
FILE_CHANGED="$(git log $PREV..$POST --pretty='format:' --name-only | grep $1)"
if [ -n "$FILE_CHANGED" ];then
echo $TRUE
@yalab
yalab / process.md
Created November 20, 2017 09:02
LinuxKernel勉強会2017-11.md

プロセス

プロセスってどうやって起動するのか調べる

linux kernel process invoke で検索すると http://www.tldp.org/LDP/tlk/kernel/processes.html

Linux の process とは task_struct 構造体の事で、task vector に 512 個まで格納される

process と task の違い?

スタッフ
1, yuukyun
2,yamazoeakiyo
3,
4,morisaki
5, higaki
6, aki
7, kyara
8,
@yalab
yalab / iptables.md
Created September 24, 2017 07:32
iptables の設定

iptables の設定

# apt-get install iptables-persistent
# cd /etc
# git add -A
# git commit -m 'apt-get install iptables-persistent'
# vi /root/iptables.sh
FROM alpine
MAINTAINER yalab <rudeboyjet@gmail.com>
RUN apk --update --no-cache add alpine-sdk ncurses-dev bc linux-headers perl
ENV ARCH="x86_64"
RUN git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git /linux
WORKDIR /linux
@yalab
yalab / numeric.c
Last active September 15, 2017 05:47
diff --git a/numeric.c b/numeric.c
index 480ab7e0cb..bdf885cf57 100644
--- a/numeric.c
+++ b/numeric.c
@@ -186,7 +186,7 @@ VALUE rb_cFixnum;
VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
-static ID id_to, id_by;
+static ID id_to, id_by, id_from;
@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