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 '.';
/**
@carwin
carwin / ci-sassy-jenkins.md
Last active December 26, 2019 14:14
Continuous Integration with Jenkins and SASS

Continuous Integration with SASS and Jenkins

This document explains how we can use Jenkins to solve some SASS/Git headaches.

The Problem at Hand

One of the problems that we deal with when working with SASS and Git is that the CSS added to the remote repository changes based on who compiled it.

That means every time someone commits to the remote repository before we can push our work up, HEAD will have changed and our push attempt will be rejected.

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 / private.xml
Last active July 27, 2017 15:06
Programmer's Shift Keys: Remapping parens, brackets and braces for to because nerd.
<?xml version="1.0"?>
<root>
<item>
<name>Programmer's Shift Keys</name>
<!--
Author: Carwin Young (@carwin)
Last Updated: 2014.07.18
v.1.1
Programmer's Shift Keys
@carwin
carwin / d7_out_of_stock_remove_addtocart.php
Created September 7, 2012 07:07
Drupal 7: Ubercart - Change the value of "Add to cart" when a product is already in a user's cart, or the product is out of stock.
<?php
// Get the "Add to cart" array ready for rendering.
$add_to_cart = array(
'#theme' => 'uc_product_add_to_cart',
'#form' => drupal_get_form('uc_product_add_to_cart_form_' . $node->nid, $node),
);
/*
* Check the database to see the Stock availability of the product.
*/
if(uc_stock_is_active($node->model)){
@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 / d7_webform_simplenews_conditional_subscription.php
Created September 6, 2012 01:39
Drupal 7: hook_webform_submission_presave() to subscribe a user to a Simplenews newsletter with a conditional component.
<?php
/*
* Implementation of hook_webform_submission_presave()
*
* For a particular Webform node, use the submitted
* value of a component to determine whether or not
* the submitter will be subscribed to a Simplenews
* newsletter.
*
* Subscribe the user to the Simplenews newsletter