Skip to content

Instantly share code, notes, and snippets.

View qykong's full-sized avatar
🐢

Quyu Kong qykong

🐢
View GitHub Profile
@qykong
qykong / gist:7ba081bafc9df1ec34809c52c18bc99c
Last active February 7, 2023 04:45
Setup PPTP VPN on CentOS7
# Got from https://www.digitalocean.com/community/questions/how-to-install-pptp-vpn-on-centos-7 and changed new workable epel rpm url
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
yum -y install ppp pptpd
cp /etc/pptpd.conf /etc/pptpd.conf.bak
cat >/etc/pptpd.conf<<EOF
option /etc/ppp/options.pptpd
logwtmp
localip 10.0.10.1
remoteip 10.0.10.2-254
@qykong
qykong / Automatically change wallpapers for xfce
Created October 7, 2016 21:53
Automatically change wallpapers for xfce downloading from bing
#!/usr/bin/env bash
PICTURE_DIR="$HOME/Pictures/bing-wallpapers/"
mkdir -p $PICTURE_DIR
urls=( $(curl -s http://www.bing.com | \
grep -Eo "url:'.*?'" | \
sed -e "s/url:'\([^']*\)'.*/http:\/\/bing.com\1/" | \
sed -e "s/\\\//g") )
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist
### General
###########################################################################
# Scrollback/History limit
set -g history-limit 2048
# Index Start
set -g base-index 1
# Mouse
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())
@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
@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
#!/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 \; \
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 \
@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