Skip to content

Instantly share code, notes, and snippets.

View xgdgsc's full-sized avatar

xgdgsc

  • Beijing,China
  • 15:47 (UTC +08:00)
View GitHub Profile
@xgdgsc
xgdgsc / punzip.py
Last active December 4, 2022 11:33
python script to extract zip with GBK encoding
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# file: unzip.py
import zipfile,os,sys
if len(sys.argv)==2:
fname=sys.argv[1]
else:
print "Usage: python %s filename\n\n" % sys.argv[0]
sys.exit()
@xgdgsc
xgdgsc / fcitx-diagnose
Created March 16, 2014 07:11
fcitx-diagnose
# System Info:
1. `uname -a`:
Linux gsc-arch 3.10.33-1-lts #1 SMP Fri Mar 7 12:51:18 UTC 2014 x86_64 GNU/Linux
2. `lsb_release`:
`lsb_release` not found.
3. `/etc/lsb-release`:
@xgdgsc
xgdgsc / mexopts.sh
Last active August 29, 2015 13:57
mexopts.sh for mac os 10.9 using gcc
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
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
@xgdgsc
xgdgsc / gist:4d11b45336dbf0e978fa
Created June 27, 2015 02:16
gnome suspend log
Jun 27 00:51:26 gsc-arch gnome-session[3822]: (gnome-shell:3893): GLib-GObject-WARNING **: gsignal.c:2569: instance '0x334c700' has no handler with id '124312'
Jun 27 00:51:32 gsc-arch systemd-logind[577]: Power key pressed.
Jun 27 00:51:32 gsc-arch NetworkManager[573]: <info> sleep requested (sleeping: no enabled: yes)
Jun 27 00:51:32 gsc-arch NetworkManager[573]: <info> sleeping...
Jun 27 00:51:32 gsc-arch NetworkManager[573]: <info> (wlp2s0): device state change: unavailable -> unmanaged (reason 'sleeping') [20 10 37]
Jun 27 00:51:32 gsc-arch NetworkManager[573]: <info> NetworkManager state is now ASLEEP
Jun 27 00:51:32 gsc-arch kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
Jun 27 00:51:32 gsc-arch gnome-session[1250]: Window manager warning: Failed to set power save mode for output LVDS9: Permission denied
Jun 27 00:51:32 gsc-arch gnome-session[1250]: Window manager warning: Failed to set power save mode for output VGA15: Permission denied
Jun 27 00:51:35 gsc-arch systemd-logind[577]:
@xgdgsc
xgdgsc / mexopt.sh
Created September 14, 2015 13:28
mexopt.sh for clang-omp
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
@xgdgsc
xgdgsc / get_tushare_data.py
Created November 22, 2015 08:01
get tushare data
# coding: utf-8
import tushare as ts
import pandas as pd
import pickle
stock_list = ts.get_stock_basics()
# In[ ]:
@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
//!
@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 / tail-slack.sh
Created June 28, 2017 15:11
tail-slack
#!/bin/bash
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2";
done