Skip to content

Instantly share code, notes, and snippets.

View pwittchen's full-sized avatar
🎯
Focusing

Piotr Wittchen pwittchen

🎯
Focusing
View GitHub Profile
@pwittchen
pwittchen / readIp.sh
Created September 6, 2016 10:31
get ip used in local network (works on OS X)
ifconfig | grep inet | awk 'END{print}' | awk '{print $2}'
for(final Annotation annotation : this.getClass().getAnnotations()) {
final Class<? extends Annotation> annotationType = annotation.annotationType();
final boolean classIsAnnotated = annotationType.equals(MyCustomAnnotation.class);
}
@pwittchen
pwittchen / hybris_banner.txt
Created May 30, 2016 13:45
Hybris ASCII art
__ __ _ _ _
/ / __ __ \ \ | |__ _ _| |__ _ __(_)___
| | \ \ / / | | | '_ \| | | | '_ \| '__| / __|
| | \ V / | | | | | | |_| | |_) | | | \__ \
| | \ \ | | |_| |_|\__, |_.__/|_| |_|___/
\_\ \_\ /_/ |___/
@pwittchen
pwittchen / killProcessByName.sh
Created May 10, 2016 10:16
Killing Linux process by name
ps aux | grep outlook | awk '{print $2}' | xargs kill -9
@pwittchen
pwittchen / static_server.js
Created April 27, 2016 13:42 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@pwittchen
pwittchen / ContactsProvider.java
Last active April 17, 2016 06:19
ContactsProvider class
public class ContactsProvider {
private Uri QUERY_URI = ContactsContract.Contacts.CONTENT_URI;
private String CONTACT_ID = ContactsContract.Contacts._ID;
private String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;
private Uri EMAIL_CONTENT_URI = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
private String EMAIL_CONTACT_ID = ContactsContract.CommonDataKinds.Email.CONTACT_ID;
private String EMAIL_DATA = ContactsContract.CommonDataKinds.Email.DATA;
private String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER;
private String PHONE_NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;
@Override protected void onPause() {
super.onPause();
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
info = (TextView) findViewById(R.id.info);
swipe = new Swipe();
subscription = swipe.observe()
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
@Override public boolean dispatchTouchEvent(MotionEvent event) {
swipe.dispatchTouchEvent(event);
return super.dispatchTouchEvent(event);
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
info = (TextView) findViewById(R.id.info);
swipe = new Swipe();
swipe.addListener(new SwipeListener() {
@Override public void onSwipingLeft(final MotionEvent event) {
info.setText("SWIPING_LEFT");