Skip to content

Instantly share code, notes, and snippets.

View mardukbp's full-sized avatar

Marduk Bolaños mardukbp

View GitHub Profile
@mardukbp
mardukbp / bibtex2ebib.js
Created September 16, 2013 03:27
Export citation in bibtex format from Conkeror to ebib
function ebib_import_bibtex (url) {
var cmd_str = 'emacsclient -ne \'(ebib-import-bibtex \"' + url + '\")\'';
shell_command_blind(cmd_str);
}
interactive("bibtex2ebib", "Download PDF and add bibtex entry for current preprint to ebib",
function (I) {
ebib_import_bibtex(I.buffer.display_uri_string);
});
@mardukbp
mardukbp / matExp.py
Created November 8, 2013 19:28
Calculate the exponential of a square matrix using the algorithm in Leonard, I. E., SIAM Rev. (38), 507, 1996.
def matExp(A):
"""
Return the matrix exponential of A using the algorithm in
Leonard, I. E., SIAM Rev. (38), 507, 1996.
"""
n = A.rows
M = []
for i in range(n):
@mardukbp
mardukbp / gist:59a1cac1379d0d112a47
Last active August 29, 2015 14:13
Compilation of poppler 0.13 fails
$ cabal install hoodle
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/poppler-0.13-24093/poppler-0.13/SetupWrapper.hs, /tmp/poppler-0.13-24093/poppler-0.13/dist/setup/SetupWrapper.o )
/tmp/poppler-0.13-24093/poppler-0.13/SetupWrapper.hs:118:28: Warning:
In the use of ‘configCompiler’
(imported from Distribution.Simple.Configure):
Deprecated: "'configCompiler' is deprecated. Use 'configCompilerEx' instead."
[2 of 2] Compiling Main ( /tmp/poppler-0.13-24093/poppler-0.13/dist/setup/setup.hs, /tmp/poppler-0.13-24093/poppler-0.13/dist/setup/Main.o )
Linking /tmp/poppler-0.13-24093/poppler-0.13/dist/setup/setup ...
com.oracle.truffle.r.runtime.RInternalError: java.lang.RuntimeException: com.oracle.truffle.r.runtime.RInternalError: java.lang.NullPointerException
at com.oracle.truffle.r.nodes.function.FunctionDefinitionNode.execute(FunctionDefinitionNode.java:333)
at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect(DefaultCallTarget.java:85)
at com.oracle.truffle.api.impl.DefaultDirectCallNode.call(DefaultDirectCallNode.java:59)
at com.oracle.truffle.r.nodes.function.call.CallRFunctionNode.execute(CallRFunctionNode.java:63)
at com.oracle.truffle.r.nodes.function.RCallNode$DispatchedCallNode.execute(RCallNode.java:1213)
at com.oracle.truffle.r.nodes.function.RCallNode$FunctionDispatch.dispatch(RCallNode.java:911)
at com.oracle.truffle.r.nodes.function.RCallNodeGen$FunctionDispatchNodeGen.executeAndSpecialize(RCallNodeGen.java:905)
at com.oracle.truffle.r.nodes.function.RCallNodeGen$FunctionDispatchNodeGen.execute(RCallNodeGen.java:869)
at com.oracle.truffle.r.nodes.function.RCallNode.call(RCallNo
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@mardukbp
mardukbp / tls-client.go
Created February 8, 2021 09:11 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@mardukbp
mardukbp / run-gui-apps-from-a-different-user.md
Created March 18, 2021 10:57 — forked from kasunbg/run-gui-apps-from-a-different-user.md
How to run a GUI application as a different user?

How to run a GUI application as a different user:

Suppose you are logged into your Linux box as user1 using some X window system already (with GNOME/Unity/..). Now you want to run some gui app as another user, user2.

Run:

  1. xhost + - Run as the user1. This enables access to user1's X window system from other users. You should see following output: 'access control disabled, clients can connect from any host'
  2. sudo su - user2 - Using your favorite terminal, log-in to second user.
  3. export DISPLAY=:0.0 - optional for some apps.
@mardukbp
mardukbp / comment.md
Created April 14, 2021 17:03 — forked from staltz/comment.md
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

@mardukbp
mardukbp / base94.c
Created December 6, 2021 19:51 — forked from iso2022jp/base94.c
base94 encoder/decoder
#include "base94.h"
void base94_encode(const unsigned char *plain, unsigned char *code) {
// high * 2^64 | low
unsigned long long value
= ((unsigned long long)plain[1] << 56) | ((unsigned long long)plain[2] << 48)
| ((unsigned long long)plain[3] << 40) | ((unsigned long long)plain[4] << 32)
@mardukbp
mardukbp / README.md
Created February 11, 2022 13:44 — forked from Tset-Noitamotua/README.md
HOW-TO enable MarkDown support in RobotFramework

HOW-TO enable MarkDown support in RobotFramework

You want to execute robot test which are inside fenced code blocks of a markdown file (.md) like any normal robot test? Follow the steps below then you can run your tests as simple as robot your_test_suite.md with all robot command line execution options.

This will add support for .md files to RF

  1. Clone [RobotFramework][4] repository
  2. Save the code below as 'mdreader.py' in parsing folder of your local clone. It's based on [restreader.py][1]
  3. Add this from .mdreader import MarkDownReader [here][2] to your local clone.