Skip to content

Instantly share code, notes, and snippets.

View snizovtsev's full-sized avatar

Sergei Nizovtsev snizovtsev

View GitHub Profile
@aprell
aprell / Makefile
Created March 7, 2019 19:13
Wrapping library functions using -Wl,--wrap=symbol
CC := gcc
CFLAGS += -Wall -Wextra -std=c99
LDLIBS += -lpthread
all: test_wrap
test_wrap: LDFLAGS += -Wl,--wrap=pthread_create -Wl,--wrap=pthread_join
test_wrap: test_wrap.c wrap.c
clean:
@i3v
i3v / cdm_fio.sh
Last active May 15, 2024 13:10
Reproducing CrystalDiskMark tests with fio - fixes for https://unix.stackexchange.com/revisions/480191/9
#!/bin/bash
# This script is based on https://unix.stackexchange.com/revisions/480191/9 .
# The following changes proved to be necessary to make it work on CentOS 7:
# * removed disk info (model, size) - not very useful, might not work in many cases.
# * using "bw" instead of "bw_bytes" to support fio version 3.1 (those availible through yum @base)
# * escaping exclamation mark in sed command
# * the ".fiomark.txt" is not auto-removed
LOOPS=5 #How many times to run each test
@jart
jart / blakefiler.py
Last active October 2, 2024 13:29
Turns bazel query --output=build //tensorflow:libtensorflow_framework.so into isomorphic Makefile
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@mortn
mortn / systemd-wrapper.sh
Last active July 19, 2023 16:19
Wrapper script to aid and shorten systemd commands
# vim: tabstop=4 shiftwidth=4 fenc=utf-8 spell spelllang=en cc=120
#
# FILE: systemctl-shell-wrapper.bash
# DESCRIPTION: Wrapper script to aid and shorten systemd commands
# LICENSE: Apache 2.0
# CREDITS: http://github.com/yaffare/systemd-shell-wrapper
# MODIFIED BY: http://github.com/mortn/systemd-shell-wrapper
# INSTALLATION: wget -SO/etc/profile.d/systemd-wrapper.sh [Raw URL to this]
#
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active October 21, 2024 21:31
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@MatthewKosloski
MatthewKosloski / extract-apps-spotify-directory.txt
Last active April 6, 2021 11:20
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
/*
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
The default folder is put on the desktop.
To change that, change the following part of the command:
`~/Desktop/Apps && cd ~/Desktop/Apps`
Procedure:
1. Change directory to /Applications/Spotify.app/Contents/Resources/Apps
2. Copy the files within the directory to ~/Desktop/Apps and change directory
@vasanthk
vasanthk / System Design.md
Last active November 14, 2024 11:31
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@bricker
bricker / amznymous.md
Last active April 23, 2024 11:14
An Amazon Programmer's Perspective (http://pastebin.com/BjD84BQ3)

Originally posted at http://pastebin.com/BjD84BQ3

Trigger warning: mention of suicidal ideation

tl;dr: I burned out as a developer at Amazon at the end of my second year. I’ve since found a healthy and sustainable work-life balance and enjoy work again. I write this to A) raise awareness, especially for new-hires and their families, and B) help give hope and advice to people going through the same at Amazon or other companies.

Hello, world

There’s been no shortage of anecdotes, opinions, and rebuttals regarding Amazon’s corporate culture as of late. I write this not to capitalize on the latest news-feed fad, but to share what I had already written and promptly deleted. I didn’t think anyone would want to hear my story, but it’s apparent people are going through a similar experience and don’t have a voice.

I’m a Software Development Engineer II at Amazon; SDE II basically means a software developer with at least 2–3 years of industry experience. I started at Amazon as an SDE I.

@jboner
jboner / latency.txt
Last active November 16, 2024 21:28
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD