Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
class MastodonSetUpGenerator < Rails::Generators::Base
desc "Set up Mastodon at once."
class_option :redis_host, type: :string, default: "localhost", desc: "Path for redis server"
class_option :redis_port, type: :numeric, default: 6379, desc: "Port for redis server"
class_option :redis_password, type: :string, default: "" , desc: "redis password"
class_option :redis_db, type: :numeric, default: 0, desc: "redis db path"
class_option :redis_url, type: :string, aliases: "-R", desc: "Set redis options like redis://password@host:port/path"
class_option :db_host, type: :string, default: "/var/run/postgresql", desc: "ip address or Unix domain socket path for PostgreSQL"
class_option :db_user, type: :string, default: "mastodon", desc: "PostgreSQL user"
@rob-smallshire
rob-smallshire / macOS-in-virtualbox.md
Last active April 3, 2024 19:03
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer

sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .

@okapies
okapies / mastodon-ostatus.md
Last active September 5, 2021 11:39
Mastodon OStatus API の叩き方

Mastodon が他のインスタンスと情報交換をする OStatus API の使い方。使ってるだけのユーザは知る必要がない裏側の話。

host-meta

Mastodon インスタンスに対して、RFC6415 が規定する /.well-known/host-meta というパスを要求すると以下の XML が返ってくる.

<?xml version="1.0"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
  <Link rel="lrdd" type="application/xrd+xml" template="https://[MASTODON_HOST]/.well-known/webfinger?resource={uri}"/>
</XRD>
@akihikodaki
akihikodaki / mastodon.te
Last active April 18, 2018 05:35
A SELinux policy module for Mastodon
policy_module(mastodon 1.1.2)
require {
attribute file_type;
attribute httpdcontent;
attribute port_type;
class dir {read search write};
class netlink_route_socket {bind create getattr nlmsg_read read write};
class process execmem;
@mlocati
mlocati / exceptions-tree.php
Created March 9, 2017 10:58
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@maglietti
maglietti / gistColaboration.md
Created August 21, 2015 16:33
How to collaborate on a gist

To colaborate on a gist:

  1. Clone your gist repo locally
  2. Add your friend’s fork as a remote e.g. if your friend is named Cindy: git remote add-url cindy https://gist.github.com/cindy/df03bdacaef75a80f310
  3. Fetch your friend’s commits: git fetch cindy/master
  4. Merge your friend’s changes into your repo: git merge cindy/master
  5. Push the changes back to GitHub: git push origin/master
@noonat
noonat / coreos-virtualbox.md
Last active February 10, 2023 22:00
Installing CoreOS on VirtualBox
  • Download and install VirtualBox.
  • Download the CoreOS ISO
  • Create a new VM in VirtualBox
    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM
    • Right click on the VM and click settings
  • Go to the storage tab
@nikuyoshi
nikuyoshi / build-crosscompile-env.sh
Last active November 20, 2022 13:17
Goのクロスコンパイル環境構築のためのシェルスクリプト
#!/bin/sh
# Environment list
# $GOOS $GOARCH
# darwin 386
# darwin amd64
# freebsd 386
# freebsd amd64
# freebsd arm
# linux 386