Skip to content

Instantly share code, notes, and snippets.

View wpiekutowski's full-sized avatar

Wojciech Piekutowski wpiekutowski

View GitHub Profile
@wpiekutowski
wpiekutowski / README.md
Last active January 17, 2023 16:43
Apple Virtualization NixOS ISO

Run NixOS ISO using Apple Virtualization framework (for example UTM)

  • local: Download ISO
    • 22.05 or build ISO: nix-build -A iso_minimal.aarch64-linux '<nixpkgs/nixos/release.nix>'
    • 22.11 Minimal 64-bit ARM
  • local: Mount hdiutil mount *.iso
  • local: Copy kernel and initrd: cp /Volumes/nixos-minimal-2?/boot/{Image,initrd} ..
  • local: Find and copy kernel params: less /Volumes/nixos-minimal-2?/EFI/boot/grub.cfg
  • local: Append console=hvc0 to params.
  • UTM: Create a new "drive". 16 GB is comfortable, 64 GB is plenty. Attach to your VM.
  • UTM: Attach the ISO.

Keybase proof

I hereby claim:

  • I am wpiekutowski on github.
  • I am wpiekutowski (https://keybase.io/wpiekutowski) on keybase.
  • I have a public key ASAavUvJDQEqOuNw4v_3KQvBlI1ofLEu1a1HZ4zT84tDbwo

To claim this, I am signing this object:

@wpiekutowski
wpiekutowski / some_subscription_test.exs
Created August 7, 2020 13:34
Testing subscriptions: Elixir + Absinthe + Phoenix WebSocket
defmodule App.Schema.SomeSubscriptionTest do
use App.SubscriptionCase
test "subscription: someSubscription" do
subscription_query = """
subscription {
someSubscription {
someData
}
}
@wpiekutowski
wpiekutowski / kleisli_example.rb
Created April 13, 2016 13:46
kleisli gem: raise exception on None or unwrap value
require 'kleisli'
result = Maybe(something)
case result
when None()
raise 'operation failed'
else
puts result.value
end
@wpiekutowski
wpiekutowski / .synergy.conf
Created October 3, 2011 14:59
My synergys config with PC-style Mac keyboard
# ~/.synergy.conf
# http://synergy2.sourceforge.net/configuration.html
# run with synergy -f
section: screens
morpork:
mac-mini:
alt = super
# Mac -> Mac
# ctrl = ctrl
# super = alt
Device: sat16:/dev/sda
Type: 16 Byte SCSI ATA SAT Passthru
Size: 114473 MiB
Model: [INTEL SSDSA2CW120G3]
Firmware: [4PC10302]
SMART Available: yes
Quirks: 232_AVAILABLERESERVEDSPACE 233_MEDIAWEAROUTINDICATOR 225_TOTALLBASWRITTEN 4_UNUSED 226_TIMEWORKLOADMEDIAWEAR 227_TIMEWORKLOADHOSTREADS 228_WORKLOADTIMER 3_UNUSED
Awake: yes
SMART Disk Health Good: yes
Off-line Data Collection Status: [Off-line data collection activity was never started.]
$ python buildscripts/smoke.py --mode=files jstests/drop2.js
['jstests/drop2.js']
cwd [/home/wojtek/hdd_home/projects/mgr/mongo_db/src]
num procs:217
removing: /data/db/sconsTests//mongod.lock
removing: /data/db/sconsTests//test.0
removing: /data/db/sconsTests//test.ns
removing: /data/db/sconsTests//test.1
running /home/wojtek/hdd_home/projects/mgr/mongo_db/src/mongod --port 32000 --dbpath /data/db/sconsTests/
Mon May 16 13:05:30 [initandlisten] MongoDB starting : pid=9575 port=32000 dbpath=/data/db/sconsTests/ 64-bit
@wpiekutowski
wpiekutowski / gist:785376
Created January 18, 2011 23:30
parse.rb
def parse(name)
pattern = /
(?:\[(\w+)\])?
(\w+)
(?:\[(\w+)\])?
/x
words = pattern.match(name).captures
combinations = [words[1]]
if words[0]
combinations << words[0] + words[1]
uri = URI::HTTP.build :host => 'www.google.com',
:path => '/ig/calculator',
:query => "q=1#{from.iso_code}%3D%3F#{to.iso_code}"
data = uri.read
class User
attr_accessor :first_name, :last_name
def full_name
"#{@first_name} #{@last_name}"
end
def full_name=(full_name)
@first_name, @last_name = full_name.split(' ')
end