Skip to content

Instantly share code, notes, and snippets.

@oowekyala
oowekyala / MLIRLexer.py
Last active May 14, 2025 08:06
MLIR Pygments lexer, can be used with the minted package for LaTeX
# Pygments lexer for MLIR.
# Authors: Karl F. A. Friebel (@KFAFSP), Clément Fournier (@oowekyala)
# Usage: pygmentize -x -l ./MLIRLexer.py:MLIRLexer file.mlir
#
# MIT License
#
# Copyright (c) 2025 Clément Fournier, Karl F. A. Friebel
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ethan-leba
ethan-leba / orgclock.md
Last active October 10, 2024 08:19
Clock out of org on laptop sleep (MacOS)

I recently started using org's clock features, however after repeatedly forgetting to clock out after closing my laptop, I decided to set up an automated clock-out on sleep.

Instructions

  1. brew install sleepwatcher (if not already installed)
  2. Create file at ~/.sleep with the following contents:
#!/usr/bin/env bash
@nokotan
nokotan / extract-comments.py
Created February 26, 2021 16:32
Extract Comments in C/C++ Source File
#!/usr/bin/python3
from clang.cindex import Index, Config, CursorKind
import json as JsonUtil
import os, io, sys
class MyTreeWalker:
def __init__(self):
@jakub-g
jakub-g / github-code-search-syntax.md
Created February 17, 2021 08:13
Searching files on GitHub

GitHub search docs: here

  • org:ORGNAME to filter down to org
  • org:ORGNAME -repo:ORGNAME/NOISY to filter out some repos
  • path:PATH to search by location
  • language:... or extension:... to filter by lang/extension
  • in:file, in:path, in:file,path to include contents or file paths
@Integralist
Integralist / Examples.md
Last active July 5, 2025 22:54
Vim: search and replace content using native vim cdo and cfdo commands #vim #replace #macro #quickfix

There are two 'types' to be aware of with a quickfix window:

  1. entry: the actual line content (e.g. :grep foo will show a specific line that matched within a file).
  2. file: the actual file itself (e.g. the path to the file that contained the match).

To replace content using vim (via the quickfix window) you need to choose whether you want to apply the change via the quickfix 'entry' or via the 'file' as a whole.

If you use cdo, then your 'action' (i.e. how you're going to replace content) will be applied to every entry in the quickfix window.

If you use cfdo, then your action will be applied to each file in the quickfix window.

@ShinyaKato
ShinyaKato / main.rs
Created May 21, 2020 11:16
Rust template just taking input from stdin for competitive programming.
use std::io::{self, Read};
macro_rules! input {
($it: expr) => ($it.next().unwrap().parse().unwrap());
($it: expr, $T: ty) => ($it.next().unwrap().parse::<$T>().unwrap());
}
fn main() {
let mut buf = String::new();
io::stdin().read_to_string(&mut buf).unwrap();
@ctgnauh
ctgnauh / ob-php.el
Last active February 27, 2023 07:44
org-babel functions for php evaluation
;;; ob-php.el --- org-babel functions for php evaluation
;; Copyright (C) Tristan Huang
;; Author: Tristan Huang
;; Keywords: literate programming, reproducible research
;; Homepage: https://orgmode.org
;; Version: 0.01
;;; License:
@weimeng23
weimeng23 / 24-bit-truecolor.sh
Last active June 21, 2025 15:04
test if your terminal supports 24 bit truecolor
#!/bin/bash
#
# This file echoes four gradients with 24-bit color codes
# to the terminal to demonstrate their functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
SEPARATOR=':'
@mag911
mag911 / Parallel_Tools_fix_for_Ubuntu_19.04.md
Last active May 19, 2025 16:10
Parallel Tools fix for Ubuntu 20.04, 19.04, 19.10, 18.04

Update 25 April 2020:

Many thanks to @KZL1992 @tomslominski @ptrofi @n-thumann for recent comments on their experiences with 20.04 and Parallels 13/14/15, especially the subsitution of the latest prl-tools-lin.iso for older Parallels to get it going.


First off, credit goes to github.com/rudolfratusinski for leading the way here.

https://gist.github.com/rudolfratusinski/a4d9e3caff11a4d9d81d2e84abc9afbf

@safijari
safijari / orgmode_spacemacs.org
Last active May 30, 2023 16:11
Org mode spacemacs tutorial file

I hope the tutorial has been useful to you. If it was kindly leave a like and a comment, and consider subscribing and turning on subscription notifications. I intend to make more videos like this on the topics mentioned before as well as on other spacemacs topic like magit (git plugin), large scale refactoring, and a number of other things. Thank you so much for watching.

Org tutorial

Note: a great reference can be had here http://spacemacs.org/layers/+emacs/org/README.html

Outlines/headers

Show that each outline has it’s associated “text” under it