Skip to content

Instantly share code, notes, and snippets.

@ramene
ramene / hiccup.js
Last active January 8, 2021 17:24
RoamResearch :hiccup styling
:hiccup [:iframe {
:height 550
:width 750
:scrollbar 0
:srcdoc "<!DOCTYPE html> <div id=\"observablehq-eb3a0382\">
<div class=\"observablehq-chart\"></div>
</div>
<script type=\"module\">
import {Runtime, Inspector} from \"https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js\";
@romainl
romainl / grep.md
Last active July 1, 2024 13:53
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

@baiwfg2
baiwfg2 / CMakeLists.txt
Created September 29, 2018 12:42
How to use add_custom_target and add_custom_command correctly in cmake
# References:
# https://cmake.org/cmake/help/latest/command/add_custom_target.html
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
# https://gist.github.com/socantre/7ee63133a0a3a08f3990
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777
cmake_minimum_required(VERSION 3.10)
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active July 1, 2024 21:55
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

tell application "Skim"
set thedoc to the front document
set anno to the active note of thedoc
set newtext to text of anno
set startpoint to (offset of "org-id:{" in newtext) + 8
set endpoint to (offset of "}:org-id" in newtext) - 1
if (startpoint - 8 is not equal to endpoint + 1) and (endpoint + 1 is not 0) then
set orgid to characters startpoint thru endpoint of newtext as string
do shell script "/usr/local/bin/emacsclient -n -e \"(progn (org-id-goto \\\"" & orgid & "\\\") (x-focus-frame (selected-frame)) (evil-exit-visual-state))\""
end if
@mbinna
mbinna / effective_modern_cmake.md
Last active June 26, 2024 13:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
(* EXPORT ALL SKIM NOTES TO THE CLIPBOARD WITH MARKDOWN REFERENCE LINKS
(no longer) requires hackademic URL handler from github user smargh
entirely rewritten to take advantage of Skim's built-in templating
2016-06-26 by derickfay
*)
@CMCDragonkai
CMCDragonkai / building_a_nix_package_c&c++.md
Last active April 8, 2024 16:38
Building a Nix Package (The C&C++ Version)

Building a Nix Package (The C&C++ Version)

Nix can be used to build any kind of package. But here I'm just going to focus on the simple C&C++ case.

Firstly we have to know that the final built packages will located inside /nix/store. Which is globally readable directory of all build inputs and build outputs of the Nix system. The emphasis is on readable, not writable, that is /nix/store is meant to be modified by the user or programs except for the Nix system utilities. This centralises the management of packages, and keeps our packages and package configuration consistent.

So what exactly are we trying to build. Our goal is to build a directory that will be located in /nix/store/*-package-version/, where * is the hash of the package. Preferably a version is also available, but some C&C++ packages don't have versions, so in that case, there's only /nix/store/*-package/.

What will be inside this directory? It follows the GNU Coding Standards descri

@paulirish
paulirish / what-forces-layout.md
Last active July 2, 2024 23:11
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent