NOTE: This is outdated. Check the comments below for more up-to-date forks of this gist.
Improved YARD CHEATSHEET http://yardoc.org
forked from https://gist.github.com/chetan/1827484 which is from early 2012 and contains outdated information.
I was drawn to programming, science, technology and science fiction | |
ever since I was a little kid. I can't say it's because I wanted to | |
make the world a better place. Not really. I was simply drawn to it | |
because I was drawn to it. Writing programs was fun. Figuring out how | |
nature works was fascinating. Science fiction felt like a grand | |
adventure. | |
Then I started a software company and poured every ounce of energy | |
into it. It failed. That hurt, but that part is ok. I made a lot of | |
mistakes and learned from them. This experience made me much, much |
#!/usr/bin/env python3 | |
""" | |
Code from http://www.labri.fr/perso/nrougier/python-opengl/#the-hard-way | |
""" | |
import ctypes | |
import logging |
=begin | |
This script attempts to reproduce poor glibc allocator behavior within Ruby, leading | |
to extreme memory fragmentation and process RSS bloat. | |
glibc allocates memory using per-thread "arenas". These blocks can easily fragment when | |
some objects are free'd and others are long-lived. | |
Our script runs multiple threads, all allocating randomly sized "large" Strings between 4,000 | |
and 40,000 bytes in size. This simulates Rails views with ERB creating large chunks of HTML | |
to output to the browser. Some of these strings are kept around and some are discarded. |
qemu-img convert -O raw <infile.(vdi|vmdk|$whatever)> /dev/zvol/rpool/data/<vmid>-disk0 |
[Unit] | |
Description=Sidekiq workers | |
# start as many workers as you want here | |
Wants=sidekiq@1.service | |
Wants=sidekiq@2.service | |
# ... | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/true |
#!/usr/bin/python3 | |
""" | |
# phantom.py | |
Simple but fully scriptable headless QtWebKit browser using PyQt5 in Python3, | |
specialized in executing external JavaScript and generating PDF files. A lean | |
replacement for other bulky headless browser frameworks. | |
#!/usr/bin/env ruby | |
require 'sidekiq' | |
require 'sidekiq/cli' | |
# Default to running one process per core | |
def process_count | |
return ENV['SK_PROCESS_COUNT'].to_i unless ENV['SK_PROCESS_COUNT'].to_i == 0 | |
case RbConfig::CONFIG['host_os'] |
NOTE: This is outdated. Check the comments below for more up-to-date forks of this gist.
forked from https://gist.github.com/chetan/1827484 which is from early 2012 and contains outdated information.
/* | |
* I've used blessed to create a textbox at the bottom line in the screen. | |
* The rest of the screen is the 'body' where your code output will be added. | |
* This way, when you type input, your program won't muddle it with output. | |
* | |
* To try this code: | |
* - $ npm install blessed --save | |
* - $ node screen.js | |
* | |
* Key points here are: |
import time | |
import asyncio | |
import requests | |
domain = 'http://integralist.co.uk' | |
a = '{}/foo?run={}'.format(domain, time.time()) | |
b = '{}/bar?run={}'.format(domain, time.time()) | |
async def get(url): | |
print('start: ', url) |