Skip to content

Instantly share code, notes, and snippets.

@kylefeng28
kylefeng28 / GRUB Boot from ISO
Last active December 21, 2015 04:39
A simple script to put in /etc/grub.d/ which makes iso files show up in your grub. This allows you to boot from iso files and use those for reinstalling your computer instead of using an external disk. :) You may need to alter variables to match your platform and the partition containing the iso files needs to be mounted during installation from…
#!/bin/sh
#Written by Remco Haszing: https://plus.google.com/u/0/101152546828331333610/
#Original post: https://plus.google.com/101152546828331333610/posts/8iaeaqd7hhz
for iso in /opt/iso/*.iso; do
if [ "`isoinfo -f -i $iso | grep '/CASPER/VMLINUZ.EFI;1'`" == "" ]; then
vmlinuz=vmlinuz
else
vmlinuz=vmlinuz.efi
fi
@kylefeng28
kylefeng28 / Makefile
Last active January 14, 2017 17:08
COMP 411 Lab 1 Makefile
.PHONY: all clean submit check
TARGETS=ex1 ex2 ex3
LABNO=1
MYID=$(shell id -un)
LOGDIR=/home/montek/comp411/.log
CC=gcc
CFLAGS=
@kylefeng28
kylefeng28 / .block
Last active February 26, 2017 06:52
Lexical Distance Among the Languages of Europe
We couldn’t find that file to show.
@kylefeng28
kylefeng28 / controllers:index.js
Last active July 12, 2017 00:59
Require all other files in current directory in Node.js
const fs = require('fs');
const path = require('path');
const basename = path.basename(module.filename);
const controllers = {};
fs
.readdirSync(__dirname)
.filter((file) => {
return (file.indexOf('.') !== 0) && (file !== basename) && (file.match(/\.js$/));
})
@kylefeng28
kylefeng28 / fix_mojibake.py
Last active August 30, 2024 17:35
Super hacky mojibake tools
import sys
import os
import argparse
placeholder = 'Paste mojibake here\nここで文字化けをペースト下さい'
default_source_enc = 'sjis'
# Open a file in binary mode and overwrite contents
# with the text encoded in the given encoding
def write_file(filename, encoding, text):