Skip to content

Instantly share code, notes, and snippets.

View carwin's full-sized avatar
🍔
cheeseburger

Carwin Young carwin

🍔
cheeseburger
  • Missouri
View GitHub Profile

Emacs as an Org capture server

The Concept

The general idea is to run an Emacs server as a daemon which clients can quickly connect to via a bash script. The client executes org-capture and the frame closes upon finalizing or aborting the capture.

Running a server daemon

The first step is to get an Emacs daemon running as a server with your name of choice. For this example, I’m going to use “capture” as the server name.

@carwin
carwin / Snyk-REST-urldecode-pagination.sh
Created June 7, 2022 02:36
Examples of un-encoding URL strings in a Snyk REST API response
#!/usr/bin/env bash
# This will transform all the percent encoded characters in the
# API response back into their ASCII counterparts.
# See - (https://en.wikipedia.org/wiki/Percent-encoding)
(curl -i "https://api.snyk.io/v3/orgs/<ORG_ID>/issues?project_id=<PROJECT_ID>&type=code&version=2022-04-06~experimental&limit=10" \
-H "Accept: application/vnd.api+json" \
-H "Authorization: Token REDACTED") \
| awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%..
@carwin
carwin / api_helper.ts
Last active October 20, 2021 22:25
Construct a Snyk Fix URL for project vulnerability.
// This is a helper function referenced in our fix_url_creator.ts file.
// It's been yanked from the Snyk Apps Demo repository and added here
// for context. You can likely skip to the next file.
import { AxiosInstance } from 'axios';
import { APIVersion } from '../../types';
import { API_BASE } from '../../../app';
import axios from 'axios';
import { refreshTokenInterceptor } from '.';
/**
package dice
import {
"time"
"math/rand"
)
func RollDice(count int, sides int) int {
min := 1
max := sides
@carwin
carwin / ssb-interop.js
Created August 30, 2018 18:06
Theme Slack Desktop
// Append to the bottom of /usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
// Your CSS here.
url: 'https://raw.githubusercontent.com/laCour/slack-night-mode/master/css/raw/black.css',
success: function(css) {
$("<style></style>").appendTo('head').html(css);
}
});
});
@carwin
carwin / SassMeister-input-HTML.html
Created February 12, 2016 03:16
Generated by SassMeister.com.
<div class="container">
<div class="A"><img src="http://placehold.it/1000x500" /></div>
<div class="B">
<div class="C"><img src="http://placehold.it/500x500" /></div>
<div class="D"><img src="http://placehold.it/500x500" /></div>
</div>
@carwin
carwin / UpdateAndroidHosts
Created December 1, 2014 23:44
Update Android emulator hosts file
adb pull /system/etc/hosts /tmp/hosts
echo "192.168.57.1 test.example.com" >> /tmp/hosts
adb remount
adb push /tmp/hosts /system/etc
@carwin
carwin / your_module.module
Last active August 29, 2015 14:05
D7: Using the Picture module in code
<?php
/**
* Helper function.
*
* Prepares the necessary array for use with theme_picture.
*
* @param array $variables
* The image array loaded from field_get_items.
*
* @param string $group
@carwin
carwin / element-background.scss
Created May 16, 2014 22:36
element background magic
@mixin element-background($color, $direction: top) {
@if type-of($color) == list {
background-color: nth($color, 1);
@include background-image(linear-gradient($direction, $color));
}
else {
@if ($color != 'none') {
$percent: alpha($color) * 100%;
$opaque: opacify($color, 1);
$solid-color: mix($opaque, white, $percent);
@carwin
carwin / SassMeister-input.scss
Created April 4, 2014 21:06
Generated by SassMeister.com.
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
@mixin some-color-name($color) {
@if type-of($color) == 'map' {
background-image: linear-gradient(map-get($color, key1), map-get($color, key2));
}
}