Skip to content

Instantly share code, notes, and snippets.

pulsation

Block or report user

Report or block pulsation

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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
@pulsation
pulsation / closure_inheritance.js
Last active Dec 11, 2015
Experimenting with javascript closures: inheritance
View closure_inheritance.js
mynamespace = window.mynamespace || {};
mynamespace.Parent = function (param) {
var _privateProperty = param;
return {
getTwice : function () {
return _privateProperty * 2;
}
You can’t perform that action at this time.