sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
# Set the maximum number of open file descriptors
ulimit -n 20000000
# Set the memory size for TCP with minimum, default and maximum thresholds
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
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
sudo sysctl -w kern.maxfiles=75000 | |
sudo sysctl -w kern.maxfilesperproc=75000 | |
ulimit -S -n 75000 |
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
<?php | |
/** | |
* imap-attachment.php | |
* | |
* @author hakre <hakre.wordpress.com> | |
* @link http://stackoverflow.com/questions/9974334/how-to-download-mails-attachment-to-a-specific-folder-using-imap-and-php | |
*/ | |
/** | |
* Utility Class |
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
const puppeteer = require('puppeteer'); | |
class Webpage { | |
static async generatePDF(url) { | |
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode. | |
const page = await browser.newPage(); | |
await page.goto(url, { waitUntil: 'load' }); // Adjust network idle as required. | |
const pdfConfig = { | |
path: 'url.pdf', // Saves pdf to disk. | |
format: 'A4', |
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 python3 | |
from argparse import ArgumentParser | |
from multiprocessing import Pool, freeze_support | |
import socket | |
def ip2num(ip): | |
a,b,c,d = [int(v) for v in ip.split('.')] | |
return ((a*256+b)*256+c)*256+d |
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
import time | |
class memoize(object): | |
def __init__(self, timeout=60): | |
self.cache = {} | |
self.timeout = timeout | |
def _flush(self): | |
now = time.time() |
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 python3 | |
import argparse | |
from math import ceil, floor | |
sign = lambda amt: -1 if amt<0 else (1 if amt>0 else 0) | |
class dobj: |
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
def long_liq_price(wallet_balance_btc, qty, price): | |
usd = qty * int(-100000000 / price - 0.5) | |
a = wallet_balance_btc * 99925056.20784412 + 0.011498875843117663 * usd | |
a *= a>0 | |
x = usd*1.004831 - a | |
return -100000000 / int(x / qty) | |
def short_liq_price(wallet_balance_btc, qty, price): | |
usd = qty * int(-100000000 / price - 0.5) |
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 python3 | |
maint_lookup_table = [ | |
( 50000, 0.4, 0), | |
( 250000, 0.5, 50), | |
( 1000000, 1.0, 1300), | |
( 5000000, 2.5, 16300), | |
(10000000, 5.0, 141300), | |
(20000000, 10.0, 641300), |