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
| #include <assert.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| #include <stdbool.h> | |
| static char *normalize(char *field) { | |
| assert(field); | |
| typedef enum { |
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
| .PHONY: indent | |
| indent: | |
| black upfind |
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/python | |
| # For initial import, you may want to sync p4 server to an initial changelist | |
| # manually before running this script: | |
| # | |
| # p4 sync -k "...@<initial_changelist>" | |
| # git init | |
| # git commit -m "Initial commit" --allow-empty | |
| # git checkout -b p4 |
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
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <limits.h> | |
| #include <stdlib.h> | |
| int is_stdout_null() { | |
| char path[PATH_MAX], link[PATH_MAX]; | |
| sprintf(path, "/proc/self/fd/%d", STDOUT_FILENO); |
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
| for p in $(df --output=pcent /dev/sda1 /dev/sdb1) | |
| do | |
| [[ ${p/\%*} -gt 90 ]] && df -x tmpfs -x devtmpfs | mail -s "Check disk free space" f@mo.us && return | |
| done |
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 python | |
| import os | |
| from tempfile import gettempdir | |
| from bottle import route, request, run, abort | |
| @route('/') | |
| def root(): | |
| return ''' | |
| <form action="/upload" method="post" enctype="multipart/form-data"> |
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
| #!/bin/bash | |
| import() { | |
| git commit -m "Import \"$*\"" | |
| } | |
| ls=$(ls) | |
| dirname=$(basename "$(pwd)") |
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
| sam@x260:~/Workspaces$ git clone https://github.com/rodm/teamcity-vagrant.git | |
| Cloning into 'teamcity-vagrant'... | |
| remote: Counting objects: 130, done. | |
| remote: Total 130 (delta 0), reused 0 (delta 0), pack-reused 130 | |
| Receiving objects: 100% (130/130), 25.94 KiB | 0 bytes/s, done. | |
| Resolving deltas: 100% (58/58), done. | |
| Checking connectivity... done. | |
| sam@x260:~/Workspaces$ cd teamcity-vagrant/ | |
| sam@x260:~/Workspaces/teamcity-vagrant$ sudo apt-get install vagrant | |
| sam@x260:~/Workspaces/teamcity-vagrant$ cd files/ |
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
| #!/bin/sh | |
| # https://wiki.archlinux.org/index.php/HiDPI#How_to_use_non-whole_numbers | |
| gsettings set org.gnome.desktop.interface scaling-factor 2 | |
| xrandr --output eDP1 --auto --scale 1.5x1.5 | |
| xrandr --output eDP1 --panning 2880x1620 |
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
| #!/bin/bash -ex | |
| # Paste this into ssh | |
| # curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex | |
| # When forking, you can get the URL from the raw (<>) button. | |
| ### Set some command variables depending on whether we are root or not ### | |
| # This assumes you use a debian derivate, replace with yum, pacman etc. | |
| aptget='sudo apt-get' | |
| chsh='sudo chsh' |