Skip to content

Instantly share code, notes, and snippets.

View kstep's full-sized avatar
🗺️

Konstantin Stepanov kstep

🗺️
View GitHub Profile
fs=yes
cache=30720
ao=pulse
af=scaletempo
softvol-max=300
softvol=yes
@kstep
kstep / .gitconfig
Last active November 6, 2021 12:11
[alias]
co = checkout
di = diff
ci = commit
cm = commit -m
ap = add -p
dc = diff --cached
s = status -s
g = log --graph --decorate
p = push
//! # git-recent
//!
//! Prints recently checked out git branches, most recently checked out branch first.
//!
//! Usage: git recent [lines]
//!
//! Options:
//! lines - number of lines to output [default=10]
use std::io::prelude::*;
use std::env;
use std::ops::Deref;
use std::io::prelude::*;
use std::fs::File;
use std::process::Command;
fn main() {
let args = env::args().skip(1).take(3).collect::<Vec<_>>();
match args.get(1).map_or("", Deref::deref) {
wget --referer=https://github.com https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-APACHE || exit 1
wget --referer=https://github.com https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT || exit 1
sed -i -e 's_^license =.*$_license = "MIT/Apache-2.0"_' Cargo.toml
cat <<LICENSE >> README.md
## License
Licensed under either of
@kstep
kstep / linus-git-merges.txt
Created October 20, 2015 13:36
Linus on Git merge
I want clean history, but that really means (a) clean and (b) history.
People can (and probably should) rebase their _private_ trees (their own
work). That's a _cleanup_. But never other peoples code. That's a "destroy
history"
So the history part is fairly easy. There's only one major rule, and one
minor clarification:
- You must never EVER destroy other peoples history. You must not rebase
KEYMAP=us
FONT=ter-v18b
@kstep
kstep / rustrun
Last active August 29, 2015 14:23
run rust as script
#!/bin/sh
SELF="$1"
MD5=$(md5sum "${SELF}" | cut -f1 -d" ")
OUT="${SELF}.${MD5}.out"
if [ ! -f "${OUT}" ]; then
rustc -C debuginfo=0 -C prefer-dynamic "${SELF}" -o "${OUT}" || exit 1
fi
shift
exec "${OUT}" "$@"
@kstep
kstep / cargo-build
Created June 4, 2015 16:33
Build binaries from Crates.io
#!/bin/sh
REPO_URL="https://crates.io"
API_URL="$REPO_URL/api/v1"
die() {
echo "$@" >&2
exit 1
}
#![feature(plugin)]
#![plugin(regex_macros)]
extern crate regex;
use std::ops::Index;
use regex::Regex;
pub struct Re(Regex);