Skip to content

Instantly share code, notes, and snippets.

View andrask's full-sized avatar

Andras Kovi andrask

  • Budapest, Hungary
View GitHub Profile
@andrask
andrask / eventpump.go
Last active January 9, 2021 10:39
Eventpump with channels
type Event interface{}
type EventChannel chan Event
type EventPump struct {
Input EventChannel
Outputs []EventChannel
}
const BufferSize = 20
@andrask
andrask / hp3050a.md
Last active May 31, 2020 14:53
hp3050a related tricks

How to hard reset the printer?

From Home screen press Back/Cancel/Back/Back Buttons, in sequence.

  1. Pess OK to enter Support Menu (Selection Button 2).
  2. Press Selection Button 3 for Reset Menu and press OK (Selection Button 2).
  3. Press Selection Button 3 for Semi-Full Reset and press OK (Selection Button 2).
  4. Wait for unit to Power Down/Turn Off.
  5. Press Power button to turn the Printer On.
@andrask
andrask / README.md
Created December 24, 2018 15:25
How to reset a lost password on LUKS-encrypted Linux Mint Ubuntu
@andrask
andrask / fb_find_trolls.js
Last active April 9, 2018 07:58
Are you fed up with trolls on FB? This script adds a "Find trolls" button right next to the "Home" link in the blue bar. Update the trolls list to include all trolls you know. Push the "Find trolls" to mark the comments from these users with a troll face.
// ==UserScript==
// @name Facebook troll finder
// @namespace tag:[email protected],2018:andrask
// @description Find trolls in FB comment authors
// @include http://www.facebook.com/*
// @include https://www.facebook.com/*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
#! /usr/bin/env python
'''
This is a test script for http://serverfault.com/questions/741633/connection-refused-on-rhel-localhost-with-running-server
'''
import socket
port = 12000
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', port))
package rx.behaviorsubject;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.andrask</groupId>
<artifactId>p2-mirror</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<tycho.version>0.20.0</tycho.version>
</properties>
<packaging>eclipse-repository</packaging>
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
public class Something {
//
// WirelessBandManager.m
// CmdScanner
//
// Created by Andras Kovi on 2013.04.05..
#import <Foundation/Foundation.h>
#import <IOBluetooth/IOBluetooth.h>
@andrask
andrask / gist:4608603
Created January 23, 2013 15:58
Example for ExecutorService in Java
package aa;
import java.text.MessageFormat;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
public class Pooling {
private static final int NUMBER_OF_THREADS = 3;