Skip to content

Instantly share code, notes, and snippets.

@zarelit
zarelit / pgm2asc.hs
Created December 7, 2015 19:02
Haskell snippet to convert depth maps took from kinect to meshlab compatible point clouds
-- takes a PGM file and outputs an ASCII list of triplets (coordinates)
-- in order to import a kinect depth map in meshlab as a point cloud
import Data.Char(toLower)
main = interact pgm2triplets
pgm2triplets :: String -> String
pgm2triplets whole = unlines $ map showTriplet noHoles
where tokens=words whole
height=read$tokens!!2 :: Int
[annex]$ cat git-trace.log
12:49:27.838912 git.c:564 trace: exec: 'git-annex' 'webapp'
12:49:27.839054 run-command.c:336 trace: run_command: 'git-annex' 'webapp'
12:49:28.242593 git.c:351 trace: built-in: git 'config' '--null' '--list'
12:49:28.682977 git.c:351 trace: built-in: git 'show-ref' 'git-annex'
12:49:28.873175 git.c:351 trace: built-in: git 'show-ref' '--hash' 'refs/heads/git-annex'
12:49:28.911249 git.c:351 trace: built-in: git 'log' 'refs/heads/git-annex..e936fbcafa9895c8f1b5c9ca5b1afa9896f8a91b' '--pretty=%H' '-n1'
12:49:31.025794 git.c:351 trace: built-in: git 'cat-file' '--batch'
12:49:31.193102 git.c:351 trace: built-in: git 'show-ref' 'git-annex'
12:49:31.194723 git.c:351 trace: built-in: git 'show-ref' '--hash' 'refs/heads/git-annex'
@zarelit
zarelit / pre-commit
Last active April 26, 2017 06:51 — forked from sciamp/pre-commit
Git pre-commit hook for prompting to remove binding.pry and debugger line.
#!/usr/bin/env ruby
hits = []
checks = {
#'_spec\.rb$' => ['focus:[:space:]*true'],
'\.(rb|erb)$' => ['binding\.pry', 'debugger', 'byebug']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@zarelit
zarelit / host_configuration.nix
Created March 5, 2018 20:26
nixos declarative containers in bridge
{ config, pkgs, lib, ... }:
{
# Other host options
## Containers
# Containers are bridged with the physical LAN adapter
networking.bridges.br0.interfaces = ["eth0"];
# Example with gogs (VM name: projects)
containers.projects = {
@zarelit
zarelit / compile_patch.diff
Created May 1, 2018 12:23 — forked from goodwillcoding/compile_patch.diff
Patch to send compile to remote machine if Linux arch does match
diff --git a/nixops/backends/__init__.py b/nixops/backends/__init__.py
index 86ed0f4..c52e9d3 100644
--- a/nixops/backends/__init__.py
+++ b/nixops/backends/__init__.py
@@ -93,6 +93,17 @@ class MachineState(nixops.resources.ResourceState):
except nixops.ssh_util.SSHCommandFailed:
return None
+ def get_os_arch(self):
+ """Get the machine's OS archicture."""
@zarelit
zarelit / on-modify.blocks_attr.py
Created May 10, 2018 11:16 — forked from wbsch/on-modify.blocks_attr.py
Taskwarrior hook script that adds a "blocks:" pseudo-attribute for adding/modifying tasks.
#!/usr/bin/env python
#
# Adds the ability to add / modify tasks using a "blocks:" attribute,
# the opposite of "depends:".
#
# This script acts as an on-modify, on-add and on-launch hook at the same time.
#
### SETUP
# Save this file as
# ~/.task/hooks/on-modify.blocks_attr.py

Keybase proof

I hereby claim:

  • I am zarelit on github.
  • I am zarelit (https://keybase.io/zarelit) on keybase.
  • I have a public key whose fingerprint is 416B FA1B D107 1E3C 49BF 5E9A 8C02 E514 694A E632

To claim this, I am signing this object:

@zarelit
zarelit / yardoc_cheatsheet.md
Created August 13, 2018 09:17 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

@zarelit
zarelit / tw5-server.rb
Created June 7, 2020 16:34 — forked from jimfoltz/tw5-server.rb
A local server for TiddlyWiki5 that allows saving wiki.
require 'webrick'
require 'fileutils'
if ARGV.length != 0
root = ARGV.first.gsub('\\', '/')
else
root = '.'
end
BACKUP_DIR = 'bak'
@zarelit
zarelit / README.md
Created March 28, 2022 11:44 — forked from peti/README.md
Make NixOS provide version-specific LOCALE_ARCHIVE environment variables

This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE environment variables to mitigate the effects of NixOS/nixpkgs#38991.

To deploy it, copy the file into your /etc/nixos folder using a file name like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to contain the attribute:

imports = [ ./multi-glibc-locale-paths.nix ];