Skip to content

Instantly share code, notes, and snippets.

use std::io;
use std::io::{ Write };
use super::TARBOX_MAGIC;
use super::attributes;
use super::attributes::AttributeContainer;
#[derive(Clone, Debug)]
pub struct Encoder<A> where A: attributes::AttributeContainer {
inner: Vec<u8>,
# Process to add salt repo
cd to salt repo
git clone https://github.com/saltstack-formulas/openssh-formula.git openssh
cd openssh/
git config core.sparsecheckout true
echo openssh/ >> .git/info/sparse-checkout
git read-tree -mu HEAD
const initialState = {
debug: false,
item: null,
};
function makeProxyContext(currentState, updateState) {
let cur = Object.assign({}, currentState);
let proxyState = new Proxy(updateState, {
get(_, prop, receiver) {
return cur[prop];
@pirogoeth
pirogoeth / com.github.radhifadlillah.shiori.plist
Created March 25, 2018 02:13
launchd plist for github.com/RadhiFadlillah/shiori
<?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>Label</key>
<string>com.github.radhifadlillah.shiori</string>
<key>Program</key>
<string>/Users/sean/.go/bin/shiori</string>
<key>ProgramArguments</key>
<array>
@pirogoeth
pirogoeth / display-modes.awk
Created March 6, 2018 05:09
AWK script for matching display modes from `xrandr --query`
BEGIN {
matched = 0;
if (!display) {
print "No display variable set";
exit;
}
}
# Matches modelines
match($0, /^[[:blank:]]+/) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import io
import os
import re
import sys
from os import path
@pirogoeth
pirogoeth / diecast-example.py
Created February 7, 2018 05:45
Example usage for components with Diecast
# -*- coding: utf-8 -*-
# this is the base test case of the DI prototype
import logging
import sys
from typing import Callable, Type
from diecast.component import Component
from diecast.inject import build_passthru_args, make_injector
from diecast.registry import get_registry, register_component
@pirogoeth
pirogoeth / result.go
Created July 28, 2017 19:27
I tried ¯\_(ツ)_/¯
package main
import (
"errors"
"fmt"
"reflect"
"time"
)
type Result struct {
@pirogoeth
pirogoeth / tap.py
Created July 7, 2017 20:49
Python method to "tap" a config object
def dict_tap(path, default=None):
""" Retrieves the path through a dictionary.
"The config is a lot like an onion - it has layers"
example:
>>> dict_tap(
>>> 'otp.age_threshold',
>>> default=2,
>>> )
"""
@pirogoeth
pirogoeth / cockpit.yaml
Last active March 20, 2017 16:39
cockpit dev env with tmuxp and asdf
# Place this in ~/.tmuxp/cockpit.yaml OR in the root of your cockpit directory as .tmuxp.yaml
session_name: cockpit-dev
shell_command_before:
# Change this to pop in to your cockpit dev dir!
- cd ~/Projects/cockpit
- workon cockpit
windows:
- window_name: services
layout: main-horizontal