Skip to content

Instantly share code, notes, and snippets.

View junhe's full-sized avatar

Jun He junhe

View GitHub Profile
#include <string>
#include <iostream>
#include <cassert>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <algorithm>
#include <queue>
@junhe
junhe / README.md
Created August 26, 2016 19:39
xfs double discard

something

@junhe
junhe / sourcer.r
Last active August 19, 2016 21:18
# This function download my python downloader, and use the downloader to download
# the private file from github repository.
# Example:
# source_r_file_in_git_repos("doraemon", "analysis/analyzer3.r", "44a7fc3f86f621fe8d213bc7d429034d947a656e")
source_r_file_in_git_repos <- function(repo_name, file_path, commit)
{
target_dir = "/tmp/for_r_analysis_j2jxn6ah"
print("downloading the python script that is used to checkout code")
system('cd /tmp; curl -O https://gist.githubusercontent.com/junhe/eabc9a6723c786b499868c2b142d5b2d/raw/37710659c74ada5804c02edbe5489752352de452/checkout-repos.py')
#!/usr/bin/env python
import argparse
import subprocess
import os
import sys
import shlex
import time
import shutil
class cd:
@junhe
junhe / README.md
Last active August 27, 2015 02:18
Add README.md

This is a reproducer of a btrfs -o discard problem.

Wed 26 Aug 2015 09:16:38 PM CDT

Please check git log for updates.

To run

$ sudo python main.py

This will:

.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.container:before,.container:after{content:" ";display:table}.container:after{clear:both}.container:before,.container:after{content:" ";display:table}.container:after{clear:both}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.row{margin-left:-15px;margin-right:-15px}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10
@junhe
junhe / source_private_github_file.r
Created June 18, 2015 21:11
This is a file I should source in R markdown code block, so I can use it to run R code in my private github repository.
# This function download my python downloader, and use the downloader to download
# the private file from github repository.
# Example:
# source_private_github_file("doraemon", "analysis/analyzer.r", "599060f45d97538b9dffda4b54ab88d1e7eff006")
source_private_github_file <- function(repo_name, file_path, commit)
{
target_dir = "/tmp/dir_for_source_private_github_file_x32nd83sx"
# download the downloader
print("downloading the python downloader..")
@junhe
junhe / download_github_private_file.py
Last active January 1, 2024 11:19
This Python script downloads private github raw files.
#!/usr/bin/env python
import argparse
import subprocess
import os
import sys
import shlex
import time
WLRUNNER, LBAGENERATOR = ('WLRUNNER', 'LBAGENERATOR')
@junhe
junhe / create-ext4-on-loop.py
Last active August 29, 2015 14:19
create ext4 on loop dev
#!/usr/bin/env python
import itertools
import random
import argparse
import re
import subprocess
import os
import sys
import shlex
import time
@junhe
junhe / python_resources.md
Created June 17, 2014 05:21 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides