Skip to content

Instantly share code, notes, and snippets.

View joschuck's full-sized avatar

Johannes Schuck joschuck

View GitHub Profile
x10c HelloWholeWorld.x10
@joschuck
joschuck / compile
Last active March 27, 2016 10:59
mpi
mpicc my_mpi_application.c -o my_mpi_application
iptables -A INPUT -p tcp -s localhost --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j DROP
@joschuck
joschuck / checkout.sh
Last active March 20, 2018 12:02
git log
# checkout specific version of file
git checkout f08a63ff4fa7b8479f8c698e5998ee1afcac3a4e kitti_to_tfrecords.py
@joschuck
joschuck / copy array to clipboard chrome console
Last active July 27, 2021 19:58
copy array to clipboard chrome console
copy(JSON.stringify(YOUR_JSON_ARRAY_OR_OBJECT));
@joschuck
joschuck / javascript_regex
Created April 19, 2015 23:59
Javascript Regex
var regExp = new RegExp('\\d+');
var match = regExp.exec(edges[i].data.name);
var match = edges[i].data.name.match(/\d+/g);
@joschuck
joschuck / Parse Numbers Javascript
Last active March 26, 2016 16:19
Parse Numbers Javascript
parseFloat('1.45kg') // 1.45
parseFloat('77.3') // 77.3
parseFloat('077.3') // 77.3
parseFloat('0x77.3') // 0
parseFloat('.3') // 0.3
parseFloat('0.1e6') // 100000
parseInt('123.45') // 123
parseInt('77') // 77
parseInt('077',10) // 77
parseInt('77',8) // 63 (= 7 + 7*8)
@joschuck
joschuck / binar_tree_oparations.coffee
Created January 28, 2015 19:49
Binary Tree Operations
getIndex: (level, levelIndex) ->
return levelIndex + (1 << level) -1
getParentIndex: (i) ->
return (i - 1) // 2
getLeftChild: (i) ->
return 2*(i+1) - 1
getRightChild: (i) ->
@joschuck
joschuck / file_to_clipboard.sh
Last active August 29, 2015 14:14
Copy file contents to clipboard
# copy file content to clipboard
xsel --clipboard < new-clipboard-contents.txt
# copy clipboard to file
xsel --clipboard > current-clipboard-contents.txt
# To read a file into the X selection
xsel < file
# make use of the secondary selection
xsel --secondary < file
# swap the primary and secondary selections
xsel --exchange
@joschuck
joschuck / reflection_string_array.java
Last active August 29, 2015 14:14
Java Reflection API - array from final static Strings
public class Name {
private final static String = "Alice";
private final static String = "Eve";
private final static String = "Bob";
}
// somewhere else in the program
Name name = new Name();
Field[] fields = Name.class.getDeclaredFields();
List<String> names = new ArrayList<String>();