Skip to content

Instantly share code, notes, and snippets.

@kemadz
kemadz / vbox_arch_chroot.sh
Last active October 3, 2015 20:07
Chroot Part of ArchLinux Virtualbox Guest Install Script
#!/bin/sh
# Chroot Part of ArchLinux Virtualbox Guest Install Script
# timezone and hwclock
echo 'Asia/Shanghai' > /etc/timezone
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# hardware clock in local time
hwclock --systohc --localtime
# hostname
@kemadz
kemadz / vbox_arch.sh
Last active November 21, 2015 17:34
LiveISO Part of ArchLinux Virtualbox Guest Install Script
#!/bin/sh
# LiveISO Part of ArchLinux Virtualbox Guest Install Script
# system clock
# date `date +%m%d%H%M%Y.%S --date='-8 hour'`
ntpdate time.asia.apple.com
# partitions
sgdisk --zap-all /dev/sda
sgdisk \
@floer32
floer32 / tupperware.py
Last active September 26, 2022 12:13
recursively convert nested dicts to nested namedtuples, giving you something like immutable object literals
from UserDict import IterableUserDict
import collections
__author__ = 'github.com/hangtwenty'
def tupperware(mapping):
""" Convert mappings to 'tupperwares' recursively.
@evanpurkhiser
evanpurkhiser / PowerlineSymbols.otf
Created August 10, 2013 02:38
Monaco Powerline fixed
@htr
htr / xmonad.hs
Last active February 22, 2021 18:23
spotify from xmonad
{-# LANGUAGE OverloadedStrings #-}
import DBus
import DBus.Client
spotifyCtrl :: Client -> MemberName -> X ()
spotifyCtrl client command = liftIO $ do
call_ client
(methodCall "/org/mpris/MediaPlayer2" "org.mpris.MediaPlayer2.Player" command) {
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
<?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>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.18556660413742065</real>
<key>Green Component</key>
<real>0.21965453028678894</real>
@gbrks
gbrks / snapraid-sync
Last active July 3, 2023 15:37
SnapRAID sync and scrub: script and systemd timers to run nightly
#! /bin/bash
#######################################################################
# this is a helper script that keeps SnapRAID parity info in sync with
# your data. Here's how it works:
# 1) it first calls diff to figure out if the parity info is out of sync
# 2) if there are changed files (i.e. new, changed, moved or removed),
# it then checks how many files were removed.
# 3) if the deleted files exceed X (configurable), it triggers an
# alert email and stops. (in case of accidental deletions)
# 4) otherwise, it will call sync.
@dwiel
dwiel / repo_install_prereqs
Last active January 29, 2016 06:01
try installing requirements out of py.prereqs from conda, and if that fails from pypi with pip
#!/bin/bash
SCRIPT_PATH=$(readlink -f ${BASH_SOURCE[0]})
WD=$(dirname ${SCRIPT_PATH})
export PW_HOME=${WD}
if [[ -f ~/anaconda/bin/activate ]];then
source ~/anaconda/bin/activate ~/anaconda
fi
INST_CACHE_ROOT=~/.pw_install_cache
function check_if_updated()
// Render any jsonnet value (except functions) to TOML format.
local
inlineTable(body) =
"{" +
std.join(", ", ["%s = %s" % [escapeKeyToml(k), renderBody(body[k])] for k in std.objectFields(body)]) +
"}",
renderArray(body) =
local