Skip to content

Instantly share code, notes, and snippets.

View ukazap's full-sized avatar

Ukaza Perdana ukazap

View GitHub Profile
@ukazap
ukazap / UFW_ban_country.md
Created November 1, 2023 12:34 — forked from jasonruyle/UFW_ban_country.md
UFW to block countries
@ukazap
ukazap / riak_core_cluster_formation.md
Last active September 27, 2022 06:28
riak_core cluster formation

riak_core cluster formation

Set up libcluster

Use libcluster to set up cluster automatically.

Add dependency in mix.exs and run mix deps.get:

defp deps do
@ukazap
ukazap / observer.md
Created July 19, 2022 04:31 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@ukazap
ukazap / queue.ex
Created June 9, 2022 04:16
Elixir wrapper for `:queue`
defmodule Queue do
@moduledoc """
Wrapper for Erlang's :queue with optional `max_length` and O(1) `.length` query.
"""
alias __MODULE__
@type t :: %Queue{
q: {list(), list()},
length: pos_integer(),
@ukazap
ukazap / chinese-input-fedora-35-kde.md
Last active August 13, 2023 12:50
How to set up Chinese input methods on Fedora 35 (KDE)

How to set up Chinese input methods on Fedora 35 (KDE)

Source: https://yanqiyu.info/2020/08/30/fcitx5-fedora/

Install fcitx5, fcitx5 configuration tool, Pinyin & Zhuyin input method engines

sudo dnf install -y fcitx5 kcm-fcitx5 fcitx5-chinese-addons fcitx5-table-extra fcitx5-zhuyin
@ukazap
ukazap / ubuntu-20.04-macbook-pro.md
Created January 10, 2021 12:47 — forked from johnjeffers/ubuntu-20.04-macbook-pro.md
Ubuntu 20.04 on a 15" Retina MacBook Pro (Mid-2014)

Ubuntu 20.04 on a 15" Retina MacBook Pro (Mid-2014)

These are notes from my efforts to get Ubuntu 20.04 installed on my older MacBook Pro. I'm making this gist public in the hopes that it's helpful to others.

I did a Minimal install, but selected the option to install additional 3rd-party drivers.

Wifi doesn't work during the install (because it requires a 3rd-party driver), so you won't be able to choose to download updates while installing. No big deal, run a software update after the install.

The installer takes about 25 minutes to complete. Post-install, most things work. The only driver I had to manually install was for the FaceTime camera. More on that below.

FROM ukazap/ruby:dev-bionic-2.6.3 AS dev
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt install -y tmux nodejs && npm install -g yarn && \
/usr/bin/rbenv exec gem install foreman
WORKDIR /app
EXPOSE 3000
EXPOSE 3035
ENV WEBPACKER_DEV_SERVER_HOST=0.0.0.0
CMD /bin/bash
@ukazap
ukazap / environment.js
Created September 24, 2019 01:51 — forked from wingrunr21/environment.js
Simple webpacker server side rendering
const webpack = require('webpack')
const { environment } = require('@rails/webpacker')
// Don't use commons chunk for server_side_render chunk
const entries = environment.toWebpackConfig().entry
const commonsChunkEligible = Object.keys(entries).filter(name => name !== 'server_side_render')
environment.plugins.set('CommonsChunkVendor', new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: (module, count) => {
@ukazap
ukazap / ping_pong.rb
Last active September 7, 2019 02:21
Rack middleware for GAE health check without a trip to DB
module PingPong # App Engine health check without a trip to DB
class Middleware
def initialize app, ping_path = '/status'
@app = app
@ping_path = ping_path
Rails.backtrace_cleaner.add_silencer { |line| line =~ /#{File.basename(__FILE__)}/ }
end
def pong_code
200
@ukazap
ukazap / read-access.sql
Created July 4, 2019 07:16 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;