Skip to content

Instantly share code, notes, and snippets.

Avatar
✂️
Clipping to Notion

Yejun Su goofansu

✂️
Clipping to Notion
View GitHub Profile
@goofansu
goofansu / example.rb
Last active Mar 5, 2021
Print Rails configuration initialization order
View example.rb
config.before_configuration do
puts 'before_configuration'
end
config.before_initialize do
puts 'before_initialize'
end
config.to_prepare do
puts 'to_prepare'
@goofansu
goofansu / gist:3518953b3e215d98768ad371865ab3da
Created Jan 24, 2021
Load Environment Variables with dotenv in NodeJS
View gist:3518953b3e215d98768ad371865ab3da
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
@goofansu
goofansu / gist:0e9893419255463ee358914921e2ad3d
Last active Jan 24, 2021
install dpkg with dependencies
View gist:0e9893419255463ee358914921e2ad3d
sudo dpkg -i
sudo apt install -f
View gist:1b39e1115df2d940fab5aaf0de872be4
#!/usr/bin/env bash
curl --user ${CIRCLE_TOKEN}: \
--request POST \
--form revision=HEAD\
--form config=@config.yml \
--form notify=false \
https://circleci.com/api/v1.1/project/github/goofansu/brightu/tree/master
View gist:2a1001d746d70ae23a3655eaaeb27e37
region: ap
tunnels:
openapply:
subdomain: faria
host_header: rewrite
addr: faria.oa.test:80
proto: http
@goofansu
goofansu / gist:ee829c1fcd0d166479ce5abbc7aba08f
Created Jan 24, 2021
Install apt-get in docker container
View gist:ee829c1fcd0d166479ce5abbc7aba08f
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:beineri/opt-qt542-trusty -y
@goofansu
goofansu / gist:97c03efd422ec35af8d2d086ff703aa3
Created Jan 24, 2021
Fix ld: library not found for -lssl
View gist:97c03efd422ec35af8d2d086ff703aa3
# This error may happen when install gems with native extensions after the macOS upgrade.
brew install openssl
set -gx LIBRARY_PATH $LIBRARY_PATH /usr/local/opt/openssl/lib/
@goofansu
goofansu / breadboard.ex
Last active Dec 14, 2020
blink leds on RPI4
View breadboard.ex
defmodule Breadboard do
alias Circuits.GPIO
defstruct [:gpio_refs, :blink_pid]
def new do
gpio_refs = [16, 17, 26] |> Enum.map(&open_gpio/1)
%__MODULE__{gpio_refs: gpio_refs}
end
View docker.yml
FROM circleci/ruby:2.3.7-node-browsers
RUN FILE=`mktemp` &&\
URL='https://www.princexml.com/download/prince_11.4-1_debian9.1_amd64.deb' &&\
wget $URL -qO $FILE &&\
sudo dpkg -i $FILE &&\
rm -f $FILE