Skip to content

Instantly share code, notes, and snippets.

Avatar

Andras Kovi andrask

  • Budapest, Hungary
View GitHub Profile
@andrask
andrask / eventpump.go
Last active Jan 9, 2021
Eventpump with channels
View eventpump.go
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
hp3050a related tricks
View hp3050a.md

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 Dec 24, 2018
How to reset a lost password on LUKS-encrypted Linux Mint Ubuntu
View README.md
@andrask
andrask / fb_find_trolls.js
Last active Apr 9, 2018
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.
View fb_find_trolls.js
// ==UserScript==
// @name Facebook troll finder
// @namespace tag:andrask@github.com,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==
View connect_without_accept.py
#! /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))
View BehaviorSubjectSubscribeAndSendConcurrently.java
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;
View mirror-p2-repos.pom.xml
<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>
View OpenAndReadZipFile
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 {
View WirelessBandManager.m
//
// WirelessBandManager.m
// CmdScanner
//
// Created by Andras Kovi on 2013.04.05..
#import <Foundation/Foundation.h>
#import <IOBluetooth/IOBluetooth.h>
@andrask
andrask / gist:4608603
Created Jan 23, 2013
Example for ExecutorService in Java
View gist:4608603
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;