Skip to content

Instantly share code, notes, and snippets.

@qxj
qxj / README.md
Last active January 27, 2023 03:44 — forked from ascendbruce/README.md
Use mac style keyboard shortcuts on Windows with AutoHotkey (ahk) script

Use (most) macOS style keyboard shortcuts on Windows

Make Windows PC's shortcut act like macOS (Mac OS X)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

Note that:

  1. you shouldn't change the modifier keys mapping with keyboard DIP. This script assumes you use a standard PC keyboard layout, and wish to use shortcuts as if it was a mac keyboard layout.
  2. To use cmd + shift + ↑ / ↓ / ← / → (select text between cursor and top / bottom / beginning of line / end of line), You should disable the Between input languages shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys due to conflicting.
@qxj
qxj / AUC.ipynb
Created January 11, 2017 15:36 — forked from CalvinTChi/AUC.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qxj
qxj / 00-MultipleOutputs
Created January 10, 2017 07:12 — forked from airawat/00-MultipleOutputs
MultipleOutputs sample program - A program that demonstrates how to generate an output file for each key
********************************
Gist
********************************
Motivation
-----------
The typical mapreduce job creates files with the prefix "part-"..and then the "m" or "r" depending
on whether it is a map or a reduce output, and then the part number. There are scenarios where we
may want to create separate files based on criteria-data keys and/or values. Enter the "MultipleOutputs"
functionality.
@qxj
qxj / Makefile
Last active December 4, 2016 11:55 — forked from lmullen/Makefile
PDF slides and handouts using Pandoc and Beamer
SLIDES := $(patsubst %.md,%.slides.pdf,$(wildcard *.md))
HANDOUTS := $(patsubst %.md,%.handout.pdf,$(wildcard *.md))
all : $(SLIDES)
%.slides.pdf : %.md
pandoc --latex-engine=xelatex --toc $^ -t beamer --slide-level 2 -o $@
%.handout.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -V handout -o $@
@qxj
qxj / fm_lr.py
Created September 6, 2016 06:30 — forked from kalaidin/fm_lr.py
Logistic regression + Factorization machines + SGD
import numpy as np
from math import exp, log
"""
SGD for logistic loss + factorization machines
The code follows this paper:
[1] http://www.ics.uci.edu/~smyth/courses/cs277/papers/factorization_machines_with_libFM.pdf
"""
def sigmoid(x):
import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])
'''
function definitions
'''
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):
@qxj
qxj / gtest.cmake
Created April 29, 2016 18:18 — forked from oneamtu/gtest.cmake
How to add google test as an downloadable external project
########################### GTEST
# Enable ExternalProject CMake module
INCLUDE(ExternalProject)
# Set default ExternalProject root directory
SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)
# Add gtest
# http://stackoverflow.com/questions/9689183/cmake-googletest
ExternalProject_Add(
@qxj
qxj / kafka.md
Last active August 29, 2015 14:20 — forked from ashrithr/kafka.md

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
@qxj
qxj / lda_gibbs.py
Last active August 29, 2015 14:19 — forked from mblondel/lda_gibbs.py
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""