Skip to content

Instantly share code, notes, and snippets.

Avatar
🦊

Tim Peters Darksecond

🦊
View GitHub Profile
View install-arch.sh
#!/bin/bash
DRIVE=/dev/xvda
MOUNT_OPTS=defaults,x-mount.mkdir,compress=lzo,ssd,noatime
# Set up partitions
sgdisk --clear \
--new=1:0:+512MiB --typecode=1:ef00 --change-name=1:EFI \
--new=2:0:0 --typecode=2:8300 --change-name=2:system \
$DRIVE
@Darksecond
Darksecond / main.rs
Created Nov 9, 2018
Example for how specs and tcod would work together
View main.rs
extern crate tcod;
extern crate specs;
use tcod::console::{Root};
use specs::{System, VecStorage, Component, World, Builder, WriteStorage, DispatcherBuilder};
#[derive(Debug)]
enum Command {
PutCharacter(char,i32,i32),
Clear,
View constants.ts
export const KEY_TAB = 9;
export const KEY_SHIFT = 16;
export const KEY_CONTROL = 17;
export const KEY_ALT = 18;
export const KEY_SPACE = 32;
export const KEY_LEFT = 37;
export const KEY_UP = 38;
export const KEY_RIGHT = 39;
export const KEY_DOWN = 40;
export const KEY_E = 69;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<canvas class="flow" width="320" height="180"></canvas>
@Darksecond
Darksecond / mp3
Created Jun 28, 2017
Encode to mp3 using ffmpeg
View mp3
#!/bin/bash
for cmd in "$@"
do
filename="${cmd%.*}"
echo "Encoding $cmd"
ffmpeg -i "$cmd" -codec:a libmp3lame -b:a 320k -nostats -hide_banner -y -loglevel 0 "$filename.mp3"
done
View youtube-dl.conf
-o "%(uploader)s - %(title)s - %(id)s.%(ext)s"
--add-metadata
--merge-output-format mp4 -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'
--no-playlist
--write-info-json
--write-thumbnail
@Darksecond
Darksecond / README.md
Last active May 23, 2017
patch_v3.lvl
View README.md

Halo 2 patch_v3.lvl signer/checker.

The chunk checksum is just a CRC32. It seems to be inverted though. Right now it does nothing except check the signatures of each chunk.

It is easy to add json serialization/unserialization later.

@Darksecond
Darksecond / .gitconfig
Last active Mar 22, 2017
Default gitignore stuff
View .gitconfig
[core]
excludesfile = ~/.gitignore.global
View design.txt
libvm design
------------
Basically Gameboy Z80
registers
=========
[15...8] [7...0]
[A ] [F ]
[B ] [C ]
@Darksecond
Darksecond / README.md
Created Jan 11, 2016
Favicon Microgem
View README.md

Favicon Microgem

This fetches all known favicons for a url. It will return an array of hashes with a href, x and y. If the size is unknown it will return 0 for x and y