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 subprocess | |
def shell(*args, **kwargs): | |
"""Execute a shell command and return the output as a string. | |
Any additional kwargs are passed directly to subprocess.run. | |
Examples: | |
shell("date") | |
shell("date", "-u") | |
message = "hello, world" | |
shell("echo", message) |
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
# Comments in makefiles follow the same form as comments in bash. | |
# Makefiles need to be named "Makefile" or "makefile". | |
# In makefiles, variables are declared in the following manner (the entire | |
# string after the equals and up to but excluding the newline is the | |
# content of the variable) | |
# | |
# Note: there are other ways to declare variables that are not explored in this | |
# tutorial. | |
TARGET = my_cc |
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
securityDefinitions: | |
api_key: | |
in: query | |
name: key | |
type: apiKey | |
api_token: | |
in: query | |
name: token | |
type: apiKey |
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
void print_backtrace(int skip) { | |
void *backtrace_array[MAX_STACK]; | |
int stack_size = backtrace(backtrace_array, MAX_STACK); | |
backtrace_symbols_fd(&backtrace_array[skip+1], | |
stack_size - skip - 1, STDERR_FILENO); | |
} | |
void signal_backtrace(int signum) { | |
fprintf(stderr, "%s\n\n", strsignal(signum)); | |
print_backtrace(2); |
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 ruby | |
require 'digest' | |
module VanitySha | |
extend self | |
COMMITTER_PATTERN = /^committer .* \<.*\> (?<timestamp>\d+)(?<timezone>.*$)/ | |
AUTHOR_PATTERN = /^author .* \<.*\> (?<timestamp>\d+)(?<timezone>.*$)/ | |
TIMESTAMP_DELTA_MAX = 10 * 24 * 60 * 60 |
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/python | |
# -*- coding: utf-8 -*- | |
import argparse | |
import blessed | |
from collections import defaultdict | |
import csv | |
import jinja2 | |
import logging | |
import numpy |
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
CREATE TABLE metrics ( | |
id bytea NOT NULL primary key, | |
description text, | |
name text COLLATE pg_catalog."C" | |
); | |
CREATE TABLE contribution_metrics ( | |
last_update_on timestamp with time zone, | |
metric bytea NOT NULL, | |
projected double precision, |
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
psql> explain analyze select investments.id | |
from contributions | |
JOIN investments ON contributions.investment_id = investments.id | |
JOIN contribution_investment_metrics cim on cim.investment_id = investments.id | |
WHERE contributions.id = '\x58c9c0d3ee944c48b32f814d'; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=27098.32..27106.89 rows=1 width=13) (actual time=1322.324..1322.329 rows=1 loops=1) | |
Join Filter: (contributions.investment_id = investments.id) | |
-> Merge Join (cost=27098. |
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 gdb | |
from datetime import datetime | |
import sys | |
if sys.version_info > (3, 0): | |
raw_input = input | |
# | |
# The gdb constant COMPLETE_EXPRESSION was added in gdb 7.7. For earlier | |
# version of gdb, we use COMPLETE_SYMBOL which is close enough. |
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
areece@areece-laptop:~/coding/gomalloc$ ./malloccheck --checkcache=true --procs=1 | |
Malloc check ran with 1 procs for 1000000 iters of size 16 | |
Cache line shared 0 (0.00%) times | |
Cache was reused 993536 (99.35%) times | |
areece@areece-laptop:~/coding/gomalloc$ ./malloccheck --checkcache=true --procs=2 | |
Malloc check ran with 2 procs for 1000000 iters of size 16 | |
Cache line shared 128186 (12.82%) times | |
Cache was reused 859014 (85.90%) times | |
areece@areece-laptop:~/coding/gomalloc$ ./malloccheck --checkcache=true --procs=3 | |
Malloc check ran with 3 procs for 1000000 iters of size 16 |
NewerOlder