This file contains 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
Copied from http://www.programmierecke.net/howto/gpg-ssh.html | |
Saved here for posterity. | |
Tested with Yubikey NEO in 0x82 mode. | |
with smartcard (openpgp) | |
Some Links | |
Using Smartcard with Windows (Putty): Pageant for Putty with smartcard support | |
step by step |
This file contains 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 | |
# Work around for boot2docker/boot2docker#1085 | |
# Extracted from boot2docker/boot2docker#1086 | |
mkdir -p /hosthome | |
mount | grep -q /hosthome || mount -t vboxsf hosthome /hosthome \ | |
-o defaults,uid=$(id -u docker),gid=$(id -g docker) | |
ls -1 /hosthome | while read d | |
do |
This file contains 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 | |
echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode | |
echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd |
This file contains 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
javascript: function runDownloadThing(howManyToDownload) { | |
if (!howManyToDownload) { | |
howManyToDownload = 3; | |
} | |
if (window['downloadSome']) { | |
window.downloadSome(); | |
return; | |
} | |
var iter = $('div.download a.a:not([download])').toArray(); | |
iter = iter.concat($('div.row a[download]').toArray()); |
This file contains 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 | |
exec awk '{printf "\r%lu", NR}' |
This file contains 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 bash | |
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2013-07-11 | |
# | |
# _______________| netspeed : check download speed via command line. | |
# | |
# Usage: netspeed [tokyo, london, usw, use, east, west, URL] | |
# ^default U.S. west coast. | |
# [ -speed_KB/sec ] | |
# ^negation activates the Mbps converter. | |
# |
This file contains 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 { useState } from "react"; | |
const useLocalStorageState = (storageKey, defaultValue) => { | |
const [value, setValue] = useState( | |
JSON.parse(localStorage.getItem(storageKey) || "null") || defaultValue | |
); | |
const wrappedSetValue = (newValue) => { | |
localStorage.setItem(storageKey, JSON.stringify(newValue)); | |
setValue(newValue); |
This file contains 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
-- ported from https://github.com/pramsey/minimal-mvt/blob/58f3e695a305f42024dcf0ba395590bf39b0b573/minimal-mvt.py#L63-L81 | |
CREATE OR REPLACE FUNCTION ST_TileEnvelope(tileZoom integer, tileX integer, tileY integer) RETURNS geometry AS $$ | |
-- Width of world in EPSG:3857 | |
DECLARE worldMercMax float = 20037508.3427892; | |
DECLARE worldMercMin float = -1 * worldMercMax; | |
DECLARE worldMercSize float = worldMercMax - worldMercMin; | |
-- Width in tiles | |
DECLARE worldTileSize float = power(2, tileZoom); | |
-- Tile width in EPSG:3857 | |
DECLARE tileMercSize float = worldMercSize / worldTileSize; |
This file contains 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
CREATE OR REPLACE FUNCTION ST_LineChunk(geom geometry, max_length float8) RETURNS SETOF geometry AS $$ | |
WITH | |
points AS ( | |
SELECT generate_series(0, CEIL(ST_Length(geom) / max_length)::int) | |
/ CEIL(ST_Length(geom) / max_length) "end" | |
), | |
line_points AS (SELECT LAG("end", 1) OVER (ORDER BY "end") "start", "end" FROM points) | |
SELECT ST_LineSubstring(geom, "start", "end") | |
FROM line_points | |
WHERE "start" IS NOT NULL AND "start" <> 1 |
This file contains 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 | |
# size of swapfile in megabytes | |
swapsize=8000 | |
# does the swap file already exist? | |
grep -q "swapfile" /etc/fstab | |
# if not then create it | |
if [ $? -ne 0 ]; then |
OlderNewer