Skip to content

Instantly share code, notes, and snippets.

View xgdgsc's full-sized avatar

xgdgsc

  • Beijing,China
  • 11:16 (UTC +08:00)
View GitHub Profile
@xgdgsc
xgdgsc / confirm.go
Created May 26, 2018 07:39 — forked from r0l1/confirm.go
Go (golang): How to ask for user confirmation via command line
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@xgdgsc
xgdgsc / README-setup-tunnel-as-systemd-service.md
Created October 26, 2017 06:00 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@xgdgsc
xgdgsc / .bashrc
Created June 6, 2017 08:12 — forked from copperlight/.bashrc
Window Subsystem for Linux ssh-agent Configuraton
# ... more above ...
# wsfl bash is not a login shell
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# ssh-agent configuration
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*
@xgdgsc
xgdgsc / date_conversion.cpp
Created March 20, 2017 17:18 — forked from st-j/date_conversion.cpp
Convert between boost dates and Unix timestamps (time_t)
#include <ctime>
#include <iostream>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
//==============================================================================
//! Convert date part of Unix timestamp (time_t) to boost date
//!
import org.apache.spark.rdd.NewHadoopRDD
import org.apache.hadoop.hbase.mapreduce.TableInputFormat
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.Result
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import org.apache.spark.mllib.recommendation.ALS
import org.apache.spark.mllib.recommendation.Rating
import scala.collection.mutable.ArrayBuffer