Skip to content

Instantly share code, notes, and snippets.

@nbardiuk
nbardiuk / download.py
Created October 19, 2012 12:13
Download picasa album using rss file
#!/usr/bin/env python
import urllib
import re
import os
from BeautifulSoup import BeautifulSoup
def downloadImages(file):
file_handler = open(file).read()
soup = BeautifulSoup(file_handler)
#!/usr/bin/python
import telnetlib
print "Connecting to the server"
tn = telnetlib.Telnet("192.168.1.1")
print "Connected, waiting to Login"
tn.read_until("Login: ")
tn.write("\r") #login
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Stream;
public class App {
public static void main(String[] args) {
@nbardiuk
nbardiuk / FoldLeftTermination.java
Created April 10, 2016 21:20
foldLeft with early termination for javaslang stream
import javaslang.collection.Stream;
import java.util.function.BiFunction;
import java.util.function.Predicate;
public class FoldLeftTermination {
public static void main(String[] args) {
Stream<Integer> numbers = Stream.iterate(0, i -> i + 1)

Keybase proof

I hereby claim:

  • I am nbardiuk on github.
  • I am nbardiuk (https://keybase.io/nbardiuk) on keybase.
  • I have a public key ASA5L4daqULGKJ6QOuGTf831RpgYXyErnBd0U4JBP6ql7go

To claim this, I am signing this object:

@nbardiuk
nbardiuk / how-gpg.md
Created September 20, 2017 11:55 — forked from djspiewak/how-gpg.md

How to GPG as a Scala OSS Maintainer

tl;dr Generate a GPG key pair (exercising appropriate paranoia). Send it to key servers. Create a Keybase account with the public part of that key. Use your keypair to sign git tags and SBT artifacts.

GPG is probably one of the least understood day-to-day pieces of software in the modern developer's toolshed. It's certainly the least understood of the important pieces of software (literally no one cares that you can't remember grep's regex variant), and this is a testament to the mightily terrible user interface it exposes to its otherwise extremely simple functionality. It's almost like cryptographers think that part of the security comes from the fact that bad guys can't figure it out any more than the good guys can.

Anyway, GPG is important for open source in particular because of one specific feature of public/private key cryptography: signing. Any published software should be signed by the developer (or company) who published it. Ideally, consu

@nbardiuk
nbardiuk / .cvimrc
Last active March 21, 2018 12:01
cvim options
let defaultengine="duckduckgo"
let smoothscroll="true"
let scrollduration="200"
map J nextTab
map K previousTab
import java.util.Arrays;
import java.util.function.BiFunction;
import java.util.function.Function;
class Scratch {
public static void main(String[] args) {
Monoid<Integer> sum = Monoid.of(0, Integer::sum);
Fold<String, Integer> sumStrings = Fold.of(Integer::parseInt, sum);
Integer result = sumStrings.fold(Arrays.asList("1", "2", "3"));
System.out.println(result);
@nbardiuk
nbardiuk / .vimrc
Created January 25, 2020 11:39
sexp element pair
" emulate text object for pair of elements
" i.e. key/value binding/expr test/expr
"
" pair forward
xmap <buffer> ip <Plug>(sexp_inner_element)<Plug>(sexp_move_to_next_element_tail)
omap <buffer> ip :<C-U>normal vip<CR>
" pair backward
xmap <buffer> iP <Plug>(sexp_inner_element)o<Plug>(sexp_move_to_prev_element_head)
omap <buffer> iP :<C-U>normal viP<CR>