Skip to content

Instantly share code, notes, and snippets.

View qykong's full-sized avatar
🐢

Quyu Kong qykong

🐢
View GitHub Profile
@qykong
qykong / get_docker.sh
Created February 16, 2021 06:25 — forked from sequoiap/get_docker.sh
Install docker on Ubuntu
#!/usr/bin/env bash
# Convenience script for setting up docker and docker-compose on Ubuntu.
# Steps essentially copied and pasted from:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
# https://docs.docker.com/compose/install/
# Uninstall any existing docker installations
sudo apt-get remove docker docker-engine docker.io containerd runc
@qykong
qykong / Dockerfile
Last active December 1, 2020 23:28
Customized rstudio dockerfile
FROM rocker/rstudio
RUN /rocker_scripts/install_tidyverse.sh
RUN Rscript -e "install.packages(c('cowplot', 'poweRlaw', 'pbmcapply', 'devtools', 'tidyverse', 'data.table', 'bit64', 'nloptr', 'furrr', 'future', 'future.batchtools', 'igraph', 'caret', 'see', 'flexclust', 'ggrepel', 'tsne', 'R.utils', 'Hmisc', 'reticulate'))"
RUN apt-get -y update && apt-get -y install libglpk40
RUN Rscript -e "devtools::install_github('behavioral-ds/evently')"
RUN Rscript -e "evently::setup_ampl('/home/rstudio')"
RUN echo "PATH=$PATH:/home/rstudio/ampl" >> /home/rstudio/.Renviron
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
@qykong
qykong / snowflake.R
Last active November 6, 2021 00:28
decomposing Twitter ID to timestamp, datacenter_id, worker_id, and sequence_id in R
library(bit64)
twepoch <- as.integer64('1288834974657')
base <- as.integer64(2)
datacenter_id_bits <- 5
worker_id_bits <- 5
sequence_id_bits <- 12
max_datacenter_id <- 1 * base^datacenter_id_bits
max_worker_id <- 1 * base^worker_id_bits
max_sequence_id <- 1 * base^sequence_id_bits
git clone --depth=1 https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp=yes \
#!/bin/bash
tmux new-session \; \
split-window -h \; \
send-keys 'htop' C-m \; \
rename-window desktop \; \
new-window \; \
send-keys 'ssh cray' C-m \; \
split-window -h \; \
send-keys 'ssh cray' C-m \; \
@qykong
qykong / ttf-vista-fonts-installer.sh
Created July 16, 2018 05:10 — forked from maxwelleite/ttf-vista-fonts-installer.sh
Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros
#!/bin/bash
# Author: Maxwel Leite
# Website: http://needforbits.wordpress.com/
# Description: Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros
# Microsoft added a group of new "ClearType Fonts" to Windows with Windows Vista and Office 2007.
# These fonts are named Constantia, Corbel, Calibri, Cambria (and Cambria Math), Candara, and Consolas.
# Calibri became the default font on Microsoft Word 2007, and it’s still the default font on Word 2016 today.
# Dependencies: wget, fontforge and cabextract
# Note: Microsoft no longer provides the PowerPoint Viewer 2007 (v12.0.4518.1014) or any version anymore for download
# Tested: Ubuntu Saucy/Trusty/Xenial/Bionic
@inproceedings{Rizoiu2018a,
abstract = {Serious concerns have been raised about the role of `socialbots' in manipulating public opinion and influencing the outcome of elections by retweeting partisan content to increase its reach. Here we analyze the role and influence of socialbots on Twitter by determining how they contribute to retweet diffusions. We collect a large dataset of tweets during the 1st U.S. presidential debate in 2016 and we analyze its 1.5 million users from three perspectives: user influence, political behavior (partisanship and engagement) and botness. First, we define a measure of user influence based on the user's active contributions to information diffusions, i.e. their tweets and retweets. Given that Twitter does not expose the retweet structure -- it associates all retweets with the original tweet -- we model the latent diffusion structure using only tweet time and user features, and we implement a scalable novel approach to estimate influence over all possible unfoldings. Next, w
from urllib import parse
import re
import argparse
def return_md_image(latex_string):
return '![' + latex_string + '](https://render.githubusercontent.com/render/math?' + parse.urlencode({'math': latex_string.replace('$', '')}) + '&mode=inline)'
def convert_md(input_file, outputfile):
with open(input_file, 'r') as ifile:
content = ''.join(ifile.readlines())
### General
###########################################################################
# Scrollback/History limit
set -g history-limit 2048
# Index Start
set -g base-index 1
# Mouse
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist