Skip to content

Instantly share code, notes, and snippets.

@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@akihikodaki
akihikodaki / README.en.md
Last active April 20, 2024 02:43
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@niw
niw / README.en.md
Last active February 13, 2024 04:24
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac
@koshatul
koshatul / README.md
Last active April 29, 2024 17:13
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
@paolocarrasco
paolocarrasco / README.md
Last active May 3, 2024 15:20
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 3, 2024 08:18
Swift Concurrency Manifesto
@russbishop
russbishop / StringLiteral.swift
Created September 9, 2016 18:31
Make ExpressibleByStringLiteral tolerable
// If you want types initializable from String literals
// but don't want to implement three separate initializers.
extension ExpressibleByUnicodeScalarLiteral where Self: ExpressibleByStringLiteral, Self.StringLiteralType == String {
public init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
@rnapier
rnapier / fp.swift
Last active February 3, 2018 23:06
FP examples in Swift
// Just spending Saturday afternoon rewriting FP examples from Backus in Swift.
// http://worrydream.com/refs/Backus-CanProgrammingBeLiberated.pdf
//
// Surprising fact: reasonably possible with only one major problem (tuples are not collections)
// Unsurprising fact: you shouldn't write Swift this way
// Other unsurprising fact: Rob should probably get out more
// Don't judge me
// For future research: is it possible to build this without arrayFormHack and the arity 2 ∘?
// Basically, can we do this entirely with tuples or entirely with arrays? Currently almost everything
@arnoappenzeller
arnoappenzeller / appbuilders_2016_slides
Last active May 11, 2016 06:44
Link to all slides from App Builders 2016 (On going)
https://speakerdeck.com/jpsim/sourcekit-and-you ("SourceKit and you" by @jpsim)
https://speakerdeck.com/icanzilb/appbuilders-non-technical-ways-to-be-a-better-developer ("Non-technical ways to be a better developer" by @icanzlib)
https://speakerdeck.com/cesarvaliente/refactoring-wunderlist-for-android-episode-i-the-presentation-layer ("Refactoring Wunderlist for Android" by @CesarValiente)
https://speakerdeck.com/akosma/being-a-developer-after-40 ("Being a developer after 40" Medium Post:https://speakerdeck.com/akosma/being-a-developer-after-40 by @akosma)
http://seriot.ch/resources/talks_papers/20160426_error_handling.pdf ("Error Handling" by @nst021)
https://speakerdeck.com/vixentael/upgrading-approaches-to-the-secure-mobile-architectures ("Upgrading approaches to the secure mobile architecture" by @vixental)
http://de.slideshare.net/JohnSundell/dynamic-native-backenddriven-uis-app-builders-2016 ("Dynamic, native, backend-driven UIs" by @johnsundell)
https://speakerdeck.com/smashingmag/dirty-tricks-from-the
@pathikrit
pathikrit / NQueen.scala
Last active January 19, 2023 21:30
O(n!) solution to the n-Queen puzzle (https://en.wikipedia.org/wiki/Eight_queens_puzzle)
/**
* Solves the n-Queen puzzle in O(n!)
* Let p[r] be the column of the queen on the rth row (must be exactly 1 queen per row)
* There also must be exactly 1 queen per column and hence p must be a permuation of (0 until n)
* There must be n distinct (col + diag) and n distinct (col - diag) for each queen (else bishop attacks)
* @return returns a Iterator of solutions
* Each solution is an array p of length n such that p[i] is the column of the queen on the ith row
*/
def nQueens(n: Int): Iterator[Seq[Int]] =
(0 until n)