Restrict the amount of CPU and memory resources that Chrome can consume.
Tested on Ubuntu 16.04/Linux Mint 18.
Install cgroups:
sudo apt install cgroup-bin
#include <complex> | |
#include <iostream> | |
int main() { | |
const size_t limit = 1000, size = 400; // change 'size' to make it more detailed | |
const char letters[] = " 123456789abcdefghijklmnopqrstuvwxyz*"; | |
for (size_t iy = 0; iy <= size; iy++) { | |
for (size_t ix = 0, count = 0; ix <= size; ix++, count = 0) { | |
std::complex<double> c(-2.0+ix*2.5/size, 1.15-iy*2.3/size), z(0.0, 0.0); | |
while (std::norm(z) < 4.0 && count++ < limit) z = z*z+c; | |
std::cout << ((count >= limit) ? letters[0] : letters[std::min(count, sizeof(letters)-2)]); |
import argparse | |
import base64 | |
from bs4 import BeautifulSoup | |
from http import cookies | |
from http.server import HTTPServer, BaseHTTPRequestHandler | |
import json | |
import requests | |
import os | |
import socketserver | |
from urllib.parse import unquote |
Restrict the amount of CPU and memory resources that Chrome can consume.
Tested on Ubuntu 16.04/Linux Mint 18.
Install cgroups:
sudo apt install cgroup-bin
#!/bin/bash | |
# vpnc-script wrapper for use with openconnect that routes all AWS IP ranges over the VPN. | |
# Pass any additional IP ranges to be routed as args to the script. | |
# | |
# Requirements: bash, curl and jq. | |
# | |
# Example usage: | |
# openconnect https://vpn.example.com/profile --script '/path/to/vpnc-script-aws' | |
# |
I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.
I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"