Skip to content

Instantly share code, notes, and snippets.

View ahaggart's full-sized avatar

Alex Haggart ahaggart

View GitHub Profile
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@ahaggart
ahaggart / wcr
Created August 24, 2018 00:52
Get the line count of all files rooted at the current directory.
#!/bin/bash
if [ ! "$#" = "1" ]; then
echo "usage: wcr file_extension"
exit;
fi
find . -name "*.$1" | xargs wc -l
@ahaggart
ahaggart / template.html
Last active August 2, 2018 06:32
yonder wiki template
<div id="markdown-root" style="padding-top:50px;padding-left:50px"></div>
var client = new XMLHttpRequest();
client.open('GET', 'content.md');
client.onreadystatechange = function() {
var text = client.responseText;
var converter = new showdown.Converter();
var options = [
['openLinksInNewWindow', true],
['metadata', true],
['simplifiedAutoLink', true],
['excludeTrailingPunctuationFromURLs', true],
@ahaggart
ahaggart / X1C6_S3_DSDT.patch
Created July 26, 2018 07:05
The patch for the Thinkpad X1 Carbon sleep patch guide
--- dsdt.dsl 2018-03-03 14:47:12.279105691 +0100
+++ dsdt.dsl 2018-03-03 14:26:30.606427931 +0100
@@ -18,9 +18,8 @@
* Compiler ID "INTL"
* Compiler Version 0x20160527 (538314023)
*/
-DefinitionBlock ("", "DSDT", 2, "LENOVO", "SKL ", 0x00000000)
+DefinitionBlock ("", "DSDT", 2, "LENOVO", "SKL ", 0x00000001)
{
- External (_GPE.TBNF, MethodObj) // 0 Arguments
@ahaggart
ahaggart / ubuntu_thinkpad_x1_carbon_6_sleep_patch.md
Last active April 21, 2023 09:31
Ubuntu X1 Carbon 6th Gen Sleep Patching

A good night's sleep for the Lenovo X1 Carbon Gen6

This is a copy of the original blog post here, as a precaution against the link going dead. I've added a few of my own notes that I found helpful.

If you own a Lenovo X1 6th generation and want to use Linux, you're not going to be happy from the start. The entire range of hardware works splendidly and almost out of the box (let alone the fingerprint reader), but Lenovo decided to make one major change in the new UEFI firmware image. They removed traditional deep sleep (ACPI S3 sleep state) in favor of a new, Microsoft-driven sleep state called Windows Modern Standby, aka Si03. This sleep state doesn't fully turn off all components except for main memory, but puts the devices themselves into an ultra low-power state. This way, much like modern smartphones do, some devices can briefly wake up particular components of the system - most notably communication devices. The idea is, to have an always-connected feature, to e.g. downl

@ahaggart
ahaggart / .vimrc
Last active August 19, 2019 23:59 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on