Skip to content

Instantly share code, notes, and snippets.

View usami's full-sized avatar

Yu Usami usami

View GitHub Profile
@usami
usami / gist:30167fa20e9d1c47dbd791f7524390d7
Created February 5, 2026 04:33
git worktree with bare clone
# create a project dir
mkdir my-project && cd my-project
# bare clone into .bare
git clone --bare git@github.com:user/repo.git .bare
# create .git to refer bare repository
echo "gitdir: ./.bare" > .git
# configure and fetch origin
~/projects/
├── my-repo/
├── my-repo-feature-a/
├── my-repo-feature-b/
└── my-repo-hotfix/
@usami
usami / default.nix
Created May 15, 2019 08:02
default.nix for cs140e Rust
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
with nixpkgs;
stdenv.mkDerivation {
name = "rust-env";
nativeBuildInputs = [
];
@usami
usami / fde.sh
Last active May 15, 2018 02:34
FDE with Yubikey PBA on NixOS
EFI_PART="$1"
LUKS_PART="$2"
EFI_MNT=/root/boot
mkdir "$EFI_MNT"
mkfs.vfat -F 32 -n uefi "$EFI_PART"
mount "$EFI_PART" "$EFI_MNT"
STORAGE=/crypt-storage/default
mkdir -p "$(dirname $EFI_MNT$STORAGE)"
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
@usami
usami / install-ffmpeg-amazon-linux.sh
Created January 24, 2017 03:03 — forked from prashantmaurice/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on gist.github.com/gboudreau/install-ffmpeg-amazon-linux.sh
# and https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF

Keybase proof

I hereby claim:

  • I am usami on github.
  • I am yusmi (https://keybase.io/yusmi) on keybase.
  • I have a public key ASBGfEaU5gQBXRfCfNrmWxrMS67f-cXRptMvV6moWjgY5Ao

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am usami on github.
* I am yusmi (https://keybase.io/yusmi) on keybase.
* I have a public key whose fingerprint is C101 0869 F35A 7D44 49C5 8444 F509 1D37 73B1 7FE6
To claim this, I am signing this object:
#! /usr/bin/python
import sys
if (len(sys.argv) > 1):
num=int(sys.argv[1])
else:
num=int(raw_input("How many nodes are in your cluster? "))
for i in range(0, num):
print 'token %d: %d' % (i, (i*(2**127)/num))