Skip to content

Instantly share code, notes, and snippets.

View usami's full-sized avatar

Yu Usami usami

View GitHub Profile
@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))
#/bin/sh
cd ~
wget http://mirrors.sonic.net/apache/cassandra/2.0.0/apache-cassandra-2.0.0-bin.tar.gz
tar xvfz apache-cassandra-2.0.0-bin.tar.gz
cd apache-cassandra-2.0.0
sudo mkdir -p /var/lib/cassandra/data /var/lib/cassandra/commitlog /var/lib/cassandra/saved_caches
sudo mkdir -p /var/log/cassandra
sudo chmod -R a+w /var/lib/cassandra
@usami
usami / .gitconfig
Created June 20, 2013 18:28
Delete untracked files
[alias]
rmu = !git status --untracked-files --short | cut -d ' ' -f 2 | xargs rm -f