This file contains hidden or 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
[Unit] | |
Description=disable transparent huge page | |
[Service] | |
ExecStart=/bin/sh -c 'if test -f /sys/kernel/mm/transparent_hugepage/khugepaged/defrag; then /bin/echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag; fi' | |
ExecStart=/bin/sh -c 'if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag; fi' | |
ExecStart=/bin/sh -c 'if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled; fi' | |
Type=oneshot | |
[Install] |
This file contains hidden or 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
[Unit] | |
Description=supervisord daemon | |
[Service] | |
Environment="PATH=/home/www/.pyenv/shims:/home/www/.pyenv/bin:/bin:/usr/bin" | |
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf --nodaemon -u www | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or 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
[Unit] | |
Description=mongod.service | |
After=network.target disable_thp.service | |
[Service] | |
ExecStartPre=/usr/bin/install -d -m 0755 -o mongod -g mongod /var/run/mongodb | |
ExecStart=/usr/bin/mongod -f /etc/mongod.conf --fork --pidfilepath=/var/run/mongodb/mongod.pid | |
ExecStop=/usr/bin/kill -TERM $MAINPID | |
Type=forking | |
PIDFile=/var/run/mongodb/mongod.pid |
This file contains hidden or 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 | |
#fileencoding=utf-8 | |
import struct | |
import socket | |
class Node(object): | |
__slots__ = ('ip', 'country', 'district') |
This file contains hidden or 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
# author: XuTao <[email protected]> | |
# time: Sun Jul 15 21:57:17 CST 2012 | |
# Usage: mv tmux_conf.txt ~/.tmux.conf | |
#------------------------------------------ | |
#-- base --# | |
set -g default-terminal "xterm-256color" | |
#set -g default-terminal "xterm" | |
set -g display-time 3000 | |
set -g history-limit 65535 |
This file contains hidden or 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 | |
#fileencoding=utf-8 | |
from jinja2 import Environment | |
from jinja2 import FileSystemLoader | |
import datetime | |
def guess_autoescape(template_name): |
This file contains hidden or 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
template<class T> | |
class TaggedPointer | |
{ | |
public: | |
explicit TaggedPointer(T* ptr = nullptr) | |
:ptr_(ptr), | |
counter_(0) | |
{} | |
inline T* load_ptr() noexcept |
This file contains hidden or 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
template<class F, class ...Args> | |
void timeit(uint32_t repeat, F&& f, Args&&... args) | |
{ | |
auto begin_time = chrono::high_resolution_clock::now(); | |
for(uint32_t i = 0; i < repeat; ++i) | |
f(forward<Args>(args)...); | |
auto end_time = chrono::high_resolution_clock::now(); | |
printf("total time: %lldus\n", chrono::duration_cast<chrono::microseconds>(end_time - begin_time).count()); | |
printf("average time: %lldns\n", chrono::duration_cast<chrono::nanoseconds>(end_time - begin_time).count() / repeat); |
This file contains hidden or 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 <iostream> | |
#include <vector> | |
#include <string> | |
#include <mutex> | |
#include <future> | |
#include <chrono> | |
#include <random> | |
#include <utility> | |
#include <assert.h> |
NewerOlder