Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Jean-Nicolas Boulay jnbdz

🎯
Focusing
Block or report user

Report or block jnbdz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pycharm64.vmoptions
# custom PyCharm VM options
-Xms128m
-Xmx750m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
View lszipcontent.sh
#!/usr/bin/env bash
lszipcontent() {
local posPath=${1}
echo ${posPath}
for filename in ${posPath}/*.zip; do
[ -e "$filename" ] || continue
View googlechromebookmarks.sh
#!/usr/bin/env bash
googlechromebookmarks() {
cat ~/.config/google-chrome/Default/Bookmarks | \
grep -E '\"name|\"url' | \
grep -vE '\"type\"\:' | \
awk '{print $1 substr($0,index($0,$2))}' | \
sed s'/^\"name\"\:/title \= /' | \
sed s'/^\"url\"\:/url \= /' | \
sed s'/\,$//' | \
@jnbdz
jnbdz / firefox_bookmarks.sh
Last active Mar 26, 2019
Get FireFox bookmarks with the help of the terminal
View firefox_bookmarks.sh
#!/usr/bin/env bash
firefoxbookmarks() {
mkdir -p /tmp/bookmark/ && \
cp ~/.mozilla/firefox/0fkse04m.default/places.sqlite /tmp/bookmark && \
sqlite3 -line /tmp/bookmark/places.sqlite 'select moz_places.url, moz_bookmarks.title from moz_bookmarks join moz_places on moz_bookmarks.fk = moz_places.id' && \
rm /tmp/bookmark/places.sqlite
}
@jnbdz
jnbdz / color_msg.sh
Last active Mar 24, 2019
Coloring diff msg types
View color_msg.sh
#!/usr/bin/env bash
# Source: https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# $1 - Message
errorMsg() {
View loopzip.sh
#!/usr/bin/env bash
loopzip() {
echo "Starting"
local posPath=$1
echo ${posPath}
View design-patterns-anti-corruption-action.java
String action(String param) {
Mess mess = new Mess();
if (mess.contains(param, "something")) {
return mess.concat(param, "-has");
}
if (mess.isEmpty(param)) {
return mess.concat(param, "-empty");
}
if (mess.matches(param, "[something]")) {
return mess.concat(param, "-matches");
View design-patterns-anti-corruption-mess.java
class Mess {
String concat(String param, String str) { }
boolean contains(String param, String s) { }
boolean isEmpty(String param) { }
boolean matches(String param, String regex) { }
boolean startsWith(String param, String prefix) { }
}
View Kafka-Producer-head.java
/**
* Page: 44-45
*/
private Properties kafkaProps = new Properties();
kafkaProps.put("bootstrap.severs", "broker1:9092,broker2:9092");
kafkaProps.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
kafkaProps.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
producer = new KafkaProducer<String, String>(kafkaProps);
View Kafka-Consumer-head.java
/**
* Page: 69
*/
Properties props = new Properties();
props.put("bootstrap.servers", "broker1:9092,broker2:9092");
props.put("group.id", "CountryCounter");
props.put("key.deserializer", "org.apache.kafka.common.seriaization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props);
You can’t perform that action at this time.