Skip to content

Instantly share code, notes, and snippets.

View wezm's full-sized avatar

Wesley Moore wezm

View GitHub Profile
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <blkid/blkid.h> /* Linux, requires libblkid-dev on Debian/Ubuntu */
/* Small program to print the device name that a file resides on.
Uses stat to get the device id then devname or blkid_devno_to_devname
to convert the dev id to a device name */
int main(int argc, char **argv)
diff --git a/PKGBUILD b/PKGBUILD
index e890744..224afed 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,6 +7,7 @@ arch=('i686' 'x86_64')
url="https://github.com/tummychow/git-absorb"
license=('BSD')
depends=(
+ 'libgit2'
)
@wezm
wezm / xps.md
Created August 10, 2018 22:54
Hardware support on Dell XPS 15 9560 with OpenBSD
  • Ethernet: N/A
  • Wifi: No (had to use USB WiFi dongle)
  • Video: Yes
  • HDMI: Don't know
  • ZZZ: No, did not hibernate, hung
  • zzz: Yes. Suspended and resumed properly. Had to manually run netstart to start network after resuming.
  • Headphones: No sound
  • Mic: No
  • Speakers: No sound
  • LCD backlight: Yes (but only at 100%)
@wezm
wezm / x86_64-unknown-linux-gnu-binsize.log
Created January 19, 2019 22:09
impact of rust 1.32.0 removing jemalloc infavor of default system allocator (x86_64-unknown-linux-gnu)
 rustc --version
rustc 1.31.1 (b6c32da9b 2018-12-18)
 cat src/main.rs
fn main() {
println!("Hello, world!");
}
 cargo build
Compiling binsize v0.1.0 (/tmp/binsize)
Finished dev [unoptimized + debuginfo] target(s) in 0.81s
 du -h target/debug/binsize
@wezm
wezm / activitypub.rs
Last active December 21, 2017 14:17
An attempt at representing ActivityPub in Rust
use std::collections::HashMap;
use serde::ser::{Serialize, SerializeStruct};
#[derive(Default)]
pub struct Object {
pub context: Context,
pub id: String,
// type to be defined by sub-type? Or have a big enum for it?
pub attachment: Option<String>,
@wezm
wezm / org.albert.extension.websearch.json
Created January 30, 2017 20:07
Albert websearch config
[
{
"enabled": false,
"iconPath": ":google",
"name": "Google",
"trigger": "gg ",
"url": "https://www.google.com/search?q=%s"
},
{
"enabled": false,
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
#name of package
test "$PKG_NAME" || PKG_NAME=Package
test "$srcdir" || srcdir=.
# default version requirements ...
test "$REQUIRED_AUTOMAKE_VERSION" || REQUIRED_AUTOMAKE_VERSION=1.11.2
test "$REQUIRED_AUTORECONF_VERSION" || REQUIRED_AUTORECONF_VERSION=2.53
@wezm
wezm / Railscasts-wezm.xccolortheme
Created February 19, 2011 18:05
My attempt at a Railscasts inspired theme for Xcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.169 0.169 0.169</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>
@wezm
wezm / net.wezm.squid.plist
Created January 13, 2013 02:40
launchd launch agent for squid installed via Homebrew, place in ~/Library/LaunchAgents.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>net.wezm.squid</string>
<key>ProgramArguments</key>
<array>
@wezm
wezm / process.awk
Created August 9, 2012 00:07
Script to extract stats from web server access logs
#!/usr/bin/awk
BEGIN {
# Use tab as output field separator
OFS=" "
}
# Extracts the device family from the full device
# E.g iPhone from iPhone4,1
function device(full) {