Skip to content

Instantly share code, notes, and snippets.

from __future__ import print_function
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--color', help='The name of the color')
parser.add_argument('--verbose', help='Print more data',
parser.add_argument('--cuda', '-c', default=True, action='store_false')
xmeng1 /
Created Sep 16, 2019 — forked from jexchan/
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""
xmeng1 / workers.sql
Created Aug 14, 2019 — forked from kenjipm/workers.sql
The following data definition defines an organization's employee hierarchy. An employee is a manager if any other employee has their managerId set to the first employees id. An employee who is a manager may or may not also have a manager. TABLE employees id INTEGER NOT NULL PRIMARY KEY managerId INTEGER REFERENCES employees(id) name VARCHAR(30) …
View workers.sql
SELECT name FROM employees
WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT NULL);
xmeng1 / IntelliJ_IDEA__Perf_Tuning.txt
Created Jul 30, 2019 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
View IntelliJ_IDEA__Perf_Tuning.txt
xmeng1 /
Created Jul 29, 2019 — forked from BBlackwo/
Open GitKraken from the terminal
## Forked from
## Also received help from
## Open GitKraken using the current repo directory.
## This code is for fish shell. The same thing can be done in bash
## by creating an alias with the command below.
## `1>/dev/null` directs logs from the terminal
## `&` allows use of the same terminal instance to do other things
xmeng1 / wsl2-network.ps1
Created Jul 14, 2019
WSL2 Port forwarding port to linux
View wsl2-network.ps1
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
xmeng1 / akkaWebSocket.scala
Created Jun 22, 2019
Akka stream and Akka Http WebSocket Example 1
View akkaWebSocket.scala
object ChatApp extends App {
implicit val system = ActorSystem("chat")
implicit val executor: ExecutionContextExecutor = system.dispatcher
implicit val materializer = ActorMaterializer()
val route = get {
pathEndOrSingleSlash {
xmeng1 / TypeClassDemo.scala
Created Jun 18, 2019
Cats Type Class Demo
View TypeClassDemo.scala
// Define a very simple JSON AST
sealed trait Json
final case class JsObject(get: Map[String, Json]) extends Json
final case class JsString(get: String) extends Json
final case class JsNumber(get: Double) extends Json
case object JsNull extends Json
////////////////// Step 1
// The "serialize to JSON" behaviour is encoded in this trait
trait JsonWriter[A] {

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here:

After discovering it chowing 2 cores, I decided to go about disabling it.


xmeng1 /
Last active Jun 21, 2018 — forked from seangtkelley/
Install Script for Gitkraken on Fedora 27 + Launcher Icon
# Enter /opt folder (common folder for user installed programs)
# This script assumes you have proper permissions on /opt
cd /home/mengxin/Applications
# Download GitKraken
# Extract the Kraken into /opt directory