This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last_duration = 0 | |
_orig = __xonsh_history__.append | |
def _append(cmd): | |
nonlocal last_duration | |
last_duration = cmd['ts'][1] - cmd['ts'][0] | |
_orig(cmd) | |
__xonsh_history__.append = _append |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def succ(s): | |
a = list(s) | |
for i in reversed(range(len(a))): | |
a[i] = chr(ord(a[i]) + 1) | |
if a[i] <= 'z': | |
break | |
a[i] = 'a' | |
else: | |
a.insert(0, 'a') | |
return ''.join(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "compiler/crystal/syntax" | |
def transform_eval(source) | |
ast = Crystal::Parser.parse(source) | |
unless ast.is_a?(Crystal::Expressions) | |
ast = Crystal::Expressions.new([ast]) | |
end | |
exprs = (ast as Crystal::Expressions).expressions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nvidia-settings: X configuration file generated by nvidia-settings | |
# nvidia-settings: version 355.11 (buildmeister@swio-display-x86-rhel47-07) Wed Aug 26 17:14:39 PDT 2015 | |
# nvidia-xconfig: X configuration file generated by nvidia-xconfig | |
# nvidia-xconfig: version 355.11 (buildmeister@swio-display-x86-rhel47-07) Wed Aug 26 17:15:49 PDT 2015 | |
Section "ServerLayout" | |
Identifier "Layout0" | |
Screen 0 "Screen0" 0 0 | |
InputDevice "Keyboard0" "CoreKeyboard" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Choose an appropriate driver | |
Before=display-manager.service | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/bash -c 'systemd-detect-virt && d=mesa || d=nvidia; d="$d-libgl lib32-$d-libgl"; pacman -Q $d || yes | pacman -S --needed $d' | |
RemainAfterExit=yes | |
[Install] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# Requirements: Python, PyGTK, seems like it wants NumPy as well | |
# Arch Linux: pygtk, python2-numpy | |
# Use `xdotool getmouselocation` to find coordinates | |
coords = (1864, 185) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
store_fn = 'store' | |
#key_bits = 16 | |
#value_bits = 16 | |
#struct_format = 'H' | |
key_bits = 32 | |
value_bits = 32 | |
struct_format = 'I' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rm false | |
parted /dev/?da | |
mklabel msdos | |
mkpart primary ext4 1MiB 100% | |
set 1 boot on | |
quit | |
mkfs.ext4 /dev/sda1 | |
mount /dev/sda1 /mnt | |
mkdir /mnt/boot | |
mount /dev/sda1 /mnt/boot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
from flask import Flask, g | |
app = Flask(__name__) | |
languages = ['en', 'hr'] | |
def translate_to(lang, text): | |
return { | |
'/about': { | |
'hr': '/onama', |