Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

ka kaosf

🏠
Working from home
View GitHub Profile
@kaosf
kaosf / test.rb.diff
Last active March 25, 2023 06:35
Active Record Encryption, test environment, without config/master.key, on CI
View test.rb.diff
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@kaosf
kaosf / docker-compose.yml
Created February 10, 2023 17:10
Nginx on https-portal for NIP-05
View docker-compose.yml
version: '3.7'
services:
https-portal:
image: steveltn/https-portal:1
restart: always
environment:
CUSTOM_NGINX_KAOSFIELD_NET_CONFIG_BLOCK: |
location = /.well-known/nostr.json { add_header Access-Control-Allow-Origin * always; root /nostr; }
volumes:
- /some/where:/nostr:ro
@kaosf
kaosf / Dockerile
Last active February 3, 2023 15:01
Docker on Jenkins on Docker
View Dockerile
FROM jenkins/jenkins:lts-jdk11
USER root
RUN VERSION=20.10.22 && \
curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${VERSION}.tgz && \
tar xf docker-${VERSION}.tgz && \
mv docker/docker /usr/local/bin && \
rm -r docker docker-${VERSION}.tgz
USER jenkins
# ref. https://stackoverflow.com/a/43594065/1006253
@kaosf
kaosf / interesting-prime-number.md
Last active November 3, 2022 09:12
Interesting prime number
View interesting-prime-number.md

ref. https://twitter.com/abakcus/status/1587885836158308353

Check:

openssl prime 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

Output:

@kaosf
kaosf / Dockerfile
Last active September 9, 2022 18:26
Active Record in Docker
View Dockerfile
FROM ruby
COPY ["Gemfile", "Gemfile.lock", "app.rb", "/"]
RUN bundle
CMD ["ruby", "/app.rb"]
@kaosf
kaosf / file-directory-permissions-resetter.sh
Last active July 31, 2022 13:34
File/Directory permissions resetter
View file-directory-permissions-resetter.sh
# All file permissions are changed:
# 7xx -> 750
# 6xx -> 640
# All directory permissions are changed:
# 7xx -> 750
# `ls -l` output's 4th byte is owner's execute permission "x" or "-"
chmod -R o-rwx .
@kaosf
kaosf / version-in-jenkinsfile-updater.sh
Created June 26, 2022 06:48
Update `releaseVersion = '.*'` in `Jenkinsfile` automatically.
View version-in-jenkinsfile-updater.sh
#!/bin/bash
VERSION_LINE=$(grep "releaseVersion = '.*'" Jenkinsfile)
[[ $VERSION_LINE =~ releaseVersion\ =\ \'(.*)\' ]] && VERSION=${BASH_REMATCH[1]}
if [[ -z $VERSION ]]; then
echo "Could not find version in Jenkinsfile"
VERSION=$(date +%Y%m%d).0
else
DATE=$(echo $VERSION | cut -d. -f1)
@kaosf
kaosf / stylesheet-dark.scss
Created June 10, 2022 13:46
Spectre.css very simple dark theme
View stylesheet-dark.scss
$primary-color: #7775f9;
$dark-color: #aaa;
$light-color: #303742;
@import "node_modules/spectre.css/src/spectre";
// https://github.com/picturepan2/spectre/issues/629#issuecomment-641715020
@kaosf
kaosf / fork_with_new_connection.rb
Last active May 19, 2022 07:23 — forked from danieldbower/fork_with_new_connection.rb
Forking Processes In Ruby On Rails
View fork_with_new_connection.rb
# Logic for forking connections
# The forked process does not have access to static vars as far as I can discern, so I've done some stuff to check if the op threw an exception.
def fork_with_new_connection
# Store the ActiveRecord connection information
config = ActiveRecord::Base.remove_connection
pid = fork do
# tracking if the op failed for the Process exit
success = true
View tsunagu-note-1.md

tsunagu練習NOTE

動かし方

どこかのEC2なりVPSなり固定IPがあるところでserverを以下のように起動.

docker run --rm -p 18080:8080 -e TSUNAGU_TOKEN=token ghcr.io/making/tsunagu-server