This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile: g++ copyfile.cc -o copyfile -lboost_timer -lboost_system -lboost_filesystem -g | |
// Run: ./copyfile testfile destfile 100 | |
#include <string> | |
#include <iostream> | |
#include <sstream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <fstream> | |
#include <sys/sendfile.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <curl/curl.h> | |
#include <string> | |
class HttpRequest { | |
public: | |
HttpRequest(const std::string& url) : _url(url) { } | |
const std::string getResponse() { | |
doIt(); | |
return _buffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
from collections import OrderedDict | |
begin = u"""<!DOCTYPE html> | |
<html><head><meta charset="UTF-8"></head><style>li { | |
list-style: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
from ctypes import windll | |
kernel32 = windll.LoadLibrary("kernel32") | |
import functools | |
def compare(str1, str2, locale="cs-CZ"): | |
res = kernel32.CompareStringEx( | |
ctypes.c_wchar_p(locale), | |
ctypes.c_ulong(0), | |
ctypes.c_wchar_p(str1), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export_from_instiki(file_name, output_dir, extension="md"): | |
"""Export data from instiki database to external files.""" | |
import sqlite3 | |
import os | |
import codecs | |
db = sqlite3.connect(file_name) | |
cur = db.execute("SELECT * from pages") | |
if not os.path.exists(output_dir): | |
os.makedirs(output_dir) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file should replace ${CHARM_DIR}/helpers/pycharm/pycharm_load_entry_point.py | |
import os, sys | |
from pkg_resources import load_entry_point | |
if __name__ == '__main__': | |
dist = os.environ.get("PYCHARM_EP_DIST") | |
name = os.environ.get("PYCHARM_EP_NAME") | |
if dist == "ipython" and name == "ipython": | |
from IPython import start_ipython |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import zipfile | |
import sys | |
def unzip_with_encoding(archive_path, output_path, encoding): | |
zz = zipfile.ZipFile(archive_path) | |
for fp in zz.filelist: | |
bytes = zz.read(fp.filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
with open("Geant4.10.p01.includes", "w") as f: | |
for d in os.walk("."): | |
if len(d[0]) > 0: | |
f.write(d[0][2:] + "\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pandas as pd | |
import sys | |
def convert(source_name, target_name, dataset_name=None, group_name=None): | |
# data_set_name & group_name not yet used | |
if not group_name: | |
dataset_name = ".".join(s for s in source_name.split(".") if s not in ("csv", "gz", "dat", "txt", "tsv")) | |
# print(group_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rup geant4.10.01.p02-p/source/interfaces/basic/src/G4UIQt.cc geant4.10.01.p02/source/interfaces/basic/src/G4UIQt.cc | |
--- geant4.10.01.p02-p/source/interfaces/basic/src/G4UIQt.cc 2015-03-16 16:55:41.000000000 +0100 | |
+++ geant4.10.01.p02/source/interfaces/basic/src/G4UIQt.cc 2015-10-07 15:52:15.182301156 +0200 | |
@@ -721,7 +721,7 @@ bool G4UIQt::AddTabWidget( | |
fViewerTabWidget->addTab(aWidget,name); | |
- fViewerTabWidget->setCurrentIndex(fViewerTabWidget->count()-1); | |
+// fViewerTabWidget->setCurrentIndex(fViewerTabWidget->count()-1); | |