Skip to content

Instantly share code, notes, and snippets.

View screenshot.sh
#!/usr/bin/env bash
set -eu -o pipefail
if [ -z "${WAYLAND_DISPLAY:-}" ]
then
echo >&2 "This script only supports Wayland compositors"
exit 1
fi
for tool in swaymsg jq sed slurp grim notify-send wl-copy
View Dockerfile
FROM python:3.7-slim AS base
RUN apt-get update && apt-get install --no-install-recommends -y curl
ENV PATH=/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ARG POETRY_VERSION=1.2.0a2
RUN \
curl -s https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - && \
poetry --version
View cd.sh
cd() {
if [ $# -gt 1 ]; then
echo "cd: too many arguments" >&2
return 1
fi
if [ -d "$1" ]; then
pushd "$1"
elif [ "$1" == "-" ]; then
popd
View drm_fourcc
#!/usr/bin/env bash
set -eu -o pipefail
declare -r drm_fourcc_h=/usr/include/libdrm/drm_fourcc.h
declare -r prog="${BASH_SOURCE[0]}".out
update() {
fourcc_h=$(perl -pe 's/\\\n//' < "$drm_fourcc_h")
fourcc_code=($(echo "$fourcc_h" | grep -E '#define\s+\w+\s+fourcc_code' | awk '{print $2}'))
fourcc_mod_code=($(echo "$fourcc_h" | grep -E '#define\s+\w+\s+fourcc_mod_code' | awk '{print $2}'))
View mesa-mapi.patch
diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 36adde4c48c1c800b5c1..5a55b798bb0227af90dc 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -21,7 +21,7 @@
es1_glapi_mapi_tmp_h = custom_target(
'es1_glapi_mapi_tmp.h',
input : [mapi_abi_py, gl_and_es_api_files],
- output : 'glapi_mapi_tmp.h',
+ output : 'es1_glapi_mapi_tmp.h',
@1ace
1ace / timestamp.cpp
Created May 19, 2015
Unix timestamp with microsecond precision
View timestamp.cpp
#include <chrono> // std::chrono::high_resolution_clock, std::chrono::duration
#include <iostream> // std::cout
#include <iomanip> // std::fixed
int main() {
auto now = std::chrono::high_resolution_clock::now();
auto timestamp = std::chrono::duration<double>(now.time_since_epoch()).count();
std::cout << std::fixed << timestamp << std::endl;
}
@1ace
1ace / dropbox-cli-shell.patch
Created Mar 3, 2015
Patch for https://linux.dropbox.com/packages/dropbox.py making `dropbox running` compatible with a shell
View dropbox-cli-shell.patch
--- dropbox.py 2015-03-03 08:33:27.509681479 +0100
+++ dropbox.py 2015-03-03 08:34:11.816959170 +0100
@@ -1054,9 +1054,9 @@
u"""return whether dropbox is running
dropbox running
-Returns 1 if running 0 if not running.
+Returns 0 if running 1 if not running.
"""
- return int(is_dropbox_running())
@1ace
1ace / snail
Created May 11, 2014
Sometimes I get bored at 4am…
View snail
#!/usr/bin/env sh
anim=('_@"' '_@-"')
trail='.'
COLUMNS=$(tput cols)
for i in $(seq 1 $COLUMNS)
do
line=""
for j in $(seq 1 $i)
@1ace
1ace / keybase.md
Created Mar 2, 2014
Keybase.io proof of ownership for this GitHub account.
View keybase.md

Keybase proof

I hereby claim:

  • I am 1ace on github.
  • I am 1ace (https://keybase.io/1ace) on keybase.
  • I have a public key whose fingerprint is CC31 EF29 D32A 6637 8895 30F2 481D 0E9D 964E 5593

To claim this, I am signing this object: