Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim: * I am pulsation on github. * I am pulsation (https://keybase.io/pulsation) on keybase. * I have a public key ASB7h5_tSmXYXTtO3zKdiVeZ2Wg5kfOKhwZ2IufMAK8vgwo To claim this, I am signing this object:

{   "body": {     "key": {       "eldest_kid": "01207b879fed4a65d85d3b4edf329d895799d9683991f38a87067622e7cc00af2f830a",       "host": "keybase.io",       "kid": "01207b879fed4a65d85d3b4edf329d895799d9683991f38a87067622e7cc00af2f830a",       "uid": "3a079d7e17eb61cd2eddbefe8a46f219",       "username": "pulsation"     },     "merkle_root": {       "ctime": 1565805634,       "hash": "fe188eb21153f07221fa5ab59ea3ced3be204a8add143ab0430fa68f72eacb64d9f1a7cf0f195ac7cab6152138bc83b5fabd5d9d91bbd0d4fb9cff965e0ab3d5",       "hash_meta": "697c53dd5477e7556b5a4444766d691bd11a09c19040b53dce75c8a18570effe",       "seqno": 6016018     },     "service": {       "entropy": "jOrxAxWVMpeoM6x1hUrmzuWx",       "name": "github",       "username": "pulsation"     },     "type": "web_
@pulsation
pulsation / spark2-addfile-test.scala
Created May 14, 2019
addFile test in spark2 shell
View spark2-addfile-test.scala
import org.apache.spark.SparkFiles
import org.apache.spark.SparkContext
val context = spark.sparkContext
val fileName = "file.csv"
val fetchedFile = context.addFile(s"ftp://my-ftp-server.net/$fileName")
val readFile = context.textFile(SparkFiles.get(fileName)).collect()
readFile.foreach(println)
@pulsation
pulsation / extend.sh
Last active May 26, 2019 — forked from wvengen/extend.sh
Extend non-HiDPI external display above HiDPI internal display
View extend.sh
#!/bin/sh
# extend non-HiDPI external display on DP* above HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'`
View App.java
class App {
public static class SuperClass {}
public static class SubClass extends SuperClass {}
public static <T, U extends T> U returnSub(T sup, U sub) {
return sub;
}
public static void main(String[] args) {
SuperClass parent = new SuperClass();
@pulsation
pulsation / wssetoken.php
Last active Aug 29, 2015 — forked from borisguery/wssetoken.php
Test WSSE token
View wssetoken.php
#!/usr/bin/env php
<?php
function wsse_header($username, $password) {
$nonce = hash_hmac('sha512', uniqid(null, true), uniqid(), true);
$created = new DateTime('now', new DateTimezone('UTC'));
$created = $created->format(DateTime::ISO8601);
$digest = sha1($nonce.$created.$password, true);
return sprintf(
View TicTacToe.adoc

Tic Tac Toe !

To play Tic Tac Toe ! with Cypher queries.

wargames
@pulsation
pulsation / rss_dc.scala
Created Sep 20, 2013
Use scala.xml._ to parse atom rss according to dublin core namespaces
View rss_dc.scala
package rss
import scala.xml._
class Feed(val url: String) {
def downloadItems(): List[Item] = {
val root = XML.load(url)
(root \\ "item").map(buildItem(_)).toList
}
def buildItem(node: Node): Item = {
@pulsation
pulsation / hash_accu.scala
Last active Dec 22, 2015
Accumulate hash values using Scala
View hash_accu.scala
val myHashList = List("at work" -> 7, "at home" -> 5, "at david's" -> 3)
val myNewValue = "at home" -> 1
myHashList :+ myNewValue groupBy (_._1) map {case (k, v) => (k, v.map(_._2).sum)} toList
// List(at home -> 6, at work -> 7, at david's -> 3)
@pulsation
pulsation / replication_task.json
Last active Dec 21, 2015
CouchDB replication task that works with views, to be put in _replicator database.
View replication_task.json
{
"_id": "replication_task",
"source": "https://user:pass@example.iriscouch.com:6984/source-database",
"target": "target-database",
"user_ctx": {
"user": "admin",
"roles": [
"_admin"
]
},
@pulsation
pulsation / gist:6114018
Created Jul 30, 2013
Is the use of "val that = this" correct?
View gist:6114018
package eu.pulsation.alarmsandbox
import android.accounts.{AccountAuthenticatorActivity, AccountManager}
import android.os.Bundle
import android.app.Activity
import android.widget.{Button, EditText}
import android.view.View.OnClickListener
import android.view.View
import android.accounts.Account
You can’t perform that action at this time.