Skip to content

Instantly share code, notes, and snippets.

View tmandry's full-sized avatar

Tyler Mandry tmandry

View GitHub Profile
@tmandry
tmandry / .phoenix.js
Created May 18, 2014 23:48
i3-like Phoenix configuration: focusing, fullscreen, marks
// Move windows between monitors, taken from jakemcc's config
function moveToScreen(win, screen) {
if (!screen) {
return;
}
var frame = win.frame();
var oldScreenRect = win.screen().frameWithoutDockOrMenu();
var newScreenRect = screen.frameWithoutDockOrMenu();
@tmandry
tmandry / configure.diff
Created April 22, 2013 04:31
Getting the octave-forge java package (v1.2.9) to install on OS X Lion. See below for instructions and more information.
--- /tmp/java/src/configure 2012-07-25 11:34:49.000000000 -0500
+++ configure 2013-04-21 22:56:40.000000000 -0500
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65.
#
@@ -3252,9 +3252,10 @@
java_version=`$JAVA -version 2>&1 | sed -n -e 's/^java version[^0-9"]*"\([^"]*\)"/\1/p'`
@tmandry
tmandry / windowtracker.lua
Created May 27, 2015 17:07
windowtracker
--- === windowtracker ===
--- Track all windows on the screen.
---
--- You can watch for the following events:
--- * windowtracker.windowCreated: A window was created.
--- * windowtracker.windowDestroyed: A window was destroyed.
--- * windowtracker.mainWindowChanged: The main window was changed. This is usually the same as the
--- focused window, except for helper dialog boxes like file open windows and the like, which are
--- not reported by this event.
--- * windowtracker.windowMoved: A window was moved.
@tmandry
tmandry / msbuild.bzl
Created November 15, 2017 04:46
vcxproj generation from bazel aspect
def _expand_items(items):
return '\n'.join(items)
def _msb_project(*items):
return ("""<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@tmandry
tmandry / errors.txt
Created April 7, 2018 20:06
rustc type inference error
Running `rustc --crate-name core src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=dc98e8200778de86 -C extra-filename=-dc98e8200778de86 --out-dir /Users/tyler/code/rust/rust-core-template/target/debug/deps -C incremental=/Users/tyler/code/rust/rust-core-template/target/debug/incremental -L dependency=/Users/tyler/code/rust/rust-core-template/target/debug/deps`
error[E0282]: type annotations needed
--> src/iterator.rs:25:16
|
25 | val == LoopState::Continue(())
| ^^^^^^^^^^^^^^^^^^^ cannot infer type for `B`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0282`.
@tmandry
tmandry / iterator.rs
Created April 8, 2018 00:27
rustc type inference error 2
#[lang = "sized"]
#[fundamental]
pub trait Sized {
}
pub trait Clone : Sized {
fn clone(&self) -> Self;
}
#[lang = "copy"]
@tmandry
tmandry / make_border.swift
Created November 1, 2018 23:01
Creating window borders for a WM
var win: NSWindow!
func makeWindow() {
let rect = NSRect(x: 1000, y: 1000, width: 400, height: 300)
win = NSWindow(contentRect: rect, styleMask: .borderless, backing: .buffered, defer: false)
win.center()
win.level = .floating
win.hasShadow = false
win.backgroundColor = NSColor.clear
win.animationBehavior = .none
win.ignoresMouseEvents = true
#![feature(generators)]
fn main() {
let a = || {
{
let x: i32 = 5;
yield;
println!("{:?}", x);
}
{
@tmandry
tmandry / generator-objects-dwarf.txt
Last active April 30, 2019 21:46
generator-objects DWARF
0x00000189: DW_TAG_structure_type
DW_AT_name ("generator")
DW_AT_byte_size (0x18)
DW_AT_alignment (8)
0x00000190: DW_TAG_member
DW_AT_name ("__0")
DW_AT_type (0x00000246 "&mut i32")
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
// edition:2018
// aux-build:arc_wake.rs
#![feature(async_await, await_macro)]
extern crate arc_wake;
use std::pin::Pin;
use std::future::Future;
use std::sync::{