Skip to content

Instantly share code, notes, and snippets.

@ethan-leba
ethan-leba / orgclock.md
Last active June 2, 2022 09:53
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 February 7, 2024 22:56
[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 November 23, 2023 08:07
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 24, 2024 12:45
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

@maxme
maxme / raspberry-power-supply-check.sh
Last active August 5, 2023 06:45
Check your Raspberry pi power supply and USB cable
#!/bin/bash
# Before running this script, make sure you have sysbench installed:
# sudo apt-get install sysbench
#
# This script helps you check if your Raspberry pi is correctly powered.
# You can read more about Raspberry pi powering issues here: https://ownyourbits.com/2019/02/02/whats-wrong-with-the-raspberry-pi/
# If you're pi is correctly powered (stable power supply and quality cable), after running the script, you should get something like: