Skip to content

Instantly share code, notes, and snippets.

View amkisko's full-sized avatar
😺
Hymyillen suora selkä!

Andrei GitHub Makarov amkisko

😺
Hymyillen suora selkä!
  • Kisko Labs
  • Helsinki, Finland
View GitHub Profile
# helper function to embed Elm applications
# This does not support defining ports
module ElmHelper
def elm(element_id, elm_app, **flags)
tag.div('', data: { turbo: 'false' }) do
add_elm_global_flags +
tag.div('', id: element_id) +
embed_elm_app(element_id, elm_app, **flags).html_safe
end
end
@tmuka
tmuka / measurepi.sh
Last active September 18, 2023 13:27 — forked from TheRemote/measurepi.sh
Measure Raspberry Pi CPU / GPU / Core / SD clock speeds and check whether you are undervolted
#!/bin/bash
# This bash script outputs the status of your Pi and checks whether you are being throttled for undervoltage and gives you your temperature
# Article and discussion at https://jamesachambers.com/measure-raspberry-pi-undervoltage-true-clock-speeds/
# Author James A Chambers 6-6-17
# updated throttle reason codes by tmuka 2021-10
# Output current configuration
vcgencmd get_config int | egrep "(arm|core|gpu|sdram)_freq|over_volt"
# Measure clock speeds

Getting X11 GUI applications to work on OS X with Docker

Install depedent packages via Brew (one-time setup)

$ brew install socat
$ brew cask install xquartz

Setup XQuartz

@KonnorRogers
KonnorRogers / environment.js
Last active October 3, 2022 17:25
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@blocknotes
blocknotes / setup.md
Last active February 27, 2024 07:11
ActiveAdmin Trix editor setup (tested with Rails 6.0.3.3)
  • Setup the Rails project with ActiveAdmin using Webpacker: rails g active_admin:install --use_webpacker
  • Setup Trix editor for ActiveAdmin:
    • Execute: bin/rails action_text:install
    • Add Javascript library to app/javascript/packs/active_admin.js:
require("trix")
require("@rails/actiontext")
  • Add style library to app/javascript/stylesheets/active_admin.scss:
@thiagozs
thiagozs / Dockerfile
Created June 22, 2020 22:18
Docker two stage builder
FROM alpine:3.9 as builder
ENV VERSION=v12.16.2 NPM_VERSION=6 YARN_VERSION=latest
LABEL maintainer="Thiago Zilli Sarmento <thiago.zilli@gmail.com>"
LABEL builder="builder"
RUN apk upgrade --no-cache -U && \
apk add --no-cache \
ca-certificates \
@abhianair
abhianair / application.html.erb
Created May 18, 2020 08:52
Stripe payment integration in ruby on rails
<script src="https://js.stripe.com/v3/"></script>
@beginor
beginor / snowflake-id.sql
Last active May 11, 2024 18:48
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@arkty
arkty / .gitlab_ci.yml
Created December 24, 2017 22:46 — forked from Qurus/.gitlab_ci.yml
Deploy from Gitlab CI to Dokku
variables:
DOKKU_HOST: 'dokku.host.es'
IP_DOKKU_HOST: '1.2.3.4'
SSH_DOKKU_PORT: '22'
PROJECT_NAME: 'project_name'
stages:
- deploy_to_dokku
deploy_dokku:
@komasaru
komasaru / definite_ingegral_simpson.rb
Last active April 22, 2022 15:25
Ruby script to compute definite integral by Simpson rule.
#! /usr/local/bin/ruby
#*********************************************
# シンプソン則による定積分
#*********************************************
class DefiniteIntegralSimpson
# 積分区間分割数
M = 100
def initialize
# 被積分関数