Skip to content

Instantly share code, notes, and snippets.

View fikovnik's full-sized avatar

Filip Krikava fikovnik

View GitHub Profile
#!/bin/bash -x
set -e
# scp-speed-test.sh
# Author: Alec Jacobson
# Modified: Filip Krikava
#
# Test ssh connection speed by uploading and then downloading a 10000kB test
# file (optionally user-specified size)
#
# Usage:
@fikovnik
fikovnik / configuration.nix
Last active July 12, 2022 06:29
NixOS on DELL XPS 13 9360
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@fikovnik
fikovnik / getxkblayout.c
Created February 7, 2018 09:43
Get keyboard layout using X11
// compile with `gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
@fikovnik
fikovnik / Matcher.scala
Created March 2, 2018 13:32
Simple matcher for Scala
object MatchExample extends App {
trait Matcher[-T] extends (T => Boolean)
def matches[A](x: A, m: Matcher[A]) = m(x)
trait F[-C[_]] {
def contains[A >: B, B](c: C[A], x: B): Boolean
}
@fikovnik
fikovnik / base16-oceanicnext-colors.txt
Last active April 26, 2018 06:23
base16-oceanicnext theme colors specification
Index Color Name Term Name Hex Description
---------------------------------------------------------------------------------------------------------
0 black base00 1B2B34 Default Background
10 brightgreen base01 343D46 Lighter Background (Used for status bars)
11 brightyellow base02 4F5B66 Selection Background
8 brightblack base03 65737E Comments, Invisibles, Line Highlighting
12 brightblue base04 A7ADBA Dark Foreground (Used for status bars)
7 white base05 C0C5CE Default Foreground, Caret, Delimiters, Operators
13 brightmagenta base06 CDD3DE Light Foreground (Not often used)
15 brightwhite base07 D8DEE9 Light Background (Not often used)
@fikovnik
fikovnik / install-parallel.sh
Last active May 31, 2018 10:46
Install latest GNU parallel
#!/bin/sh
wget http://ftp.gnu.org/gnu/parallel/parallel-latest.tar.bz2 && \
mkdir parallel && \
tar xfvj parallel-latest.tar.bz2 -C parallel --strip 1 && \
cd parallel && \
./configure --prefix=/usr/local && \
sudo make install && \
cd .. && \
rm -fr parallel && \
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(readr)
library(devtools)
library(dplyr)
library(stringr)
let defaultengine = "duckduckgo"
let blacklists = ["http://prl4/*"]
@fikovnik
fikovnik / emacs.plist
Created October 3, 2018 18:48
emacs services on OSX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>emacs</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/emacs</string>
<string>--fg-daemon</string>
@fikovnik
fikovnik / org-insert-clipboard-image.el
Created December 14, 2018 14:25
org-insert-clipboard-image
(defun org-insert-clipboard-image ()
(interactive)
(setq dir (concat (file-name-directory (buffer-file-name)) "resources"))
(unless (file-directory-p dir) (make-directory dir))
(setq filename
(concat dir
"/"
(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))
"-"
(format-time-string "%Y%m%d-%H%M%S")