Skip to content

Instantly share code, notes, and snippets.

View avnik's full-sized avatar
🏠
Working from home

Alexander V. Nikolaev avnik

🏠
Working from home
View GitHub Profile
@avnik
avnik / -
Created October 4, 2016 23:20
[avn@bulldozer:pts/0]~/nixos/nixpkgs100% nixos-rebuild build ~/nixos/nixpkgs
building Nix...
building the system configuration...
these derivations will be built:
/nix/store/qq904qn3i1p1ban286kmiw1bbh83khys-ghc-8.0.1.drv
/nix/store/ivlsy3ych6yqyvp4yrb5zikfyhrfdd9j-env-haskell.drv
/nix/store/lpqc5nm411cn2lsx0axyd3cxjvzm87jh-system-path.drv
/nix/store/30ncixjgb5vw171q765b8wgz5k61x6lb-dbus-conf.drv
/nix/store/mbwhbcwkysxf43cd53qi2sd4rmj2mnnx-unit-dbus.service.drv
/nix/store/vq60b3qcavpqhrg8jpr9q19nk5aqckwl-unit-polkit.service.drv
with (import <nixpkgs> {}).pkgs;
with import <nixpkgs/pkgs/development/haskell-modules/lib.nix> { inherit pkgs; };
let
QuickCheck = haskellPackages.QuickCheck_2_9_2;
quickcheck-io = haskellPackages.quickcheck-io.override { inherit QuickCheck; };
quickcheck-instances = haskellPackages.quickcheck-instances.override { inherit QuickCheck; };
hspec-meta = haskellPackages.hspec-meta.override { inherit QuickCheck quickcheck-io;};
hspec-core = haskellPackages.hspec-core.override { inherit QuickCheck quickcheck-io hspec-meta;};
hspec = haskellPackages.hspec.override { inherit QuickCheck hspec-core hspec-meta; };
http-api-data = (doJailbreak haskellPackages.http-api-data_0_3_1).override {inherit QuickCheck hspec quickcheck-instances; };
let get_mouse_pos (canvas:Html.canvasElement) event =
let rect = canvas##getBoundingClientRect() in
let top = rect##.top
and bottom = rect##.bottom
and right = rect##.right
and left = rect##.left
and clientX = event##.clientX
and clientY = event##.clientY
and width = canvas##.width
and height = canvas##.height in
[10813.980554] INFO: task rsync:5179 blocked for more than 120 seconds.
[10813.980555] Tainted: P O 4.9.5 #1-NixOS
[10813.980557] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10813.980558] rsync D 0 5179 5178 0x00000000
[10813.980560] ffff9c786b09a000 0000000000000000 ffff9c786c68b500 ffff9c787ed17dc0
[10813.980562] ffff9c784b40c240 ffffbc8207b839d0 ffffffffabf58a6d 0000000000000000
[10813.980564] 0000000000000003 ffffbc8207b839b0 ffff9c784b40c240 ffff9c785fb94238
[10813.980566] Call Trace:
[10813.980568] [<ffffffffabf58a6d>] ? __schedule+0x18d/0x640
[10813.980569] [<ffffffffabf58f56>] schedule+0x36/0x80
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc801" }:
let
haskellPackages = nixpkgs.pkgs.haskell.packages.${compiler};
project = haskellPackages.callPackage ./project.nix {};
in
project
DDT-sha256-zap-duplicate: 818320 entries, size 1067 on disk, 344 in core
DDT-sha256-zap-unique: 18002319 entries, size 497 on disk, 160 in core
DDT histogram (aggregated over all DDTs):
bucket allocated referenced
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 17.2M 464G 431G 437G 17.2M 464G 431G 437G
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.xrdp;
sessionBackends = {
xorg = {
code = 20;
import logging
import socket
import time
log = logging.getLogger("initiator")
class Guacamole(object):
def __init__(self, host='127.0.0.1', port=4822, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.host = host
self.port = port
@avnik
avnik / gist:8310d70ff40c3fe531f1ff07cd954d60
Created April 1, 2017 17:01
python regex with groupdict
Python 2.7.13 (default, Dec 17 2016, 20:05:07)
[GCC 5.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> r = re.compile(r'((?P<proto>.+)://)?(((?P<user>\w+)@)?(?P<host>[^:/ ]+))(:(?P<port>\d*))?(?P<path>/[^\?]+)?')
>>> r.match("http://[email protected]:80/path").groupdict()
{'path': '/path', 'host': 'google.com', 'proto': 'http', 'port': '80', 'user': 'user'}
{ fetchgit, writeScript, openssh, stdenv
, keyFile
, realHostName, realPort
, fakeHostName ? "gitlab.private" }: args: derivation ((fetchgit args).drvAttrs // {
SSH_AUTH_SOCK = if (builtins.tryEval <ssh-auth-sock>).success
then builtins.toString <ssh-auth-sock>
else null;
GIT_SSH = writeScript "fetchgit-ssh" ''
#! ${stdenv.shell} -e
tmpTemplate="''${TMPDIR:-/tmp}/git-checkout-tmp-XXXXXXXX"