Skip to content

Instantly share code, notes, and snippets.

@benley
benley / org-to-gfm.el
Last active May 1, 2019 00:13
org-to-gfm.el
;;; org-to-gfm --- Export a org-mode file to Github-flavored Markdown
;;;
;;; Commentary:
;;; To convert INPUT_FILE.org and produce OUTPUT_FILE.md, run something like:
;;;
;;; emacs -q --no-splash --no-x-resources --batch --script org-to-gfm.el INPUT_FILE.org OUTPUT_FILE.md
;;;
;;; Code:
(unless (require 'use-package nil t) (package-install 'use-package))
@lheckemann
lheckemann / 0-readme.md
Last active March 11, 2024 13:11
Expression for a buildEnv-based declarative user environment.

Expression for a buildEnv-based declarative user environment

This is one way of managing your user profile declaratively.

Alternatives include:

  • an attrset-based nix-env-based environment, installed using nix-env -ir rather than nix-env --set. LnL has an overlay which shows a way of doing this.
  • home-manager, which provides NixOS-like config for your $HOME

Note that this is incompatible with regular imperative use of nix-env, e.g. nix-env -iA nixpkgs.hello. It has the advantage of allowing the installation of multiple outputs of the same package much better than nix-env's builtin profile builder does.

@teburd
teburd / scylla.nix
Last active April 24, 2019 07:43
scylla.nix
with import <nixpkgs> {};
#{stdenv, fetchFromGitHub, python, ninja}:
stdenv.mkDerivation rec {
name = "scylla-${version}";
version = "2.1.0";
src = fetchgit {
url = "https://github.com/scylladb/scylla";
@balsoft
balsoft / crd.nix
Last active April 7, 2024 11:36
chrome-remote-desktop on nixos/nix
{ config, lib, pkgs, ...}:
with lib;
let
cfg = config.services.crd;
in {
options = {
services.crd = {
enable = mkEnableOption ''
chrome remote desktop, a service which allows for remote control of your desktop from anywhere.
'';
@jhass
jhass / README.md
Last active May 7, 2024 07:11 — forked from yorkxin/README.md
Proxy to remote server with CORS support

cors.py for mitmproxy

Hacking CORS restriction to enable in-browser XHR to any server.

Usage

Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.

Run:

@gesellix
gesellix / screen-stuff.md
Created May 1, 2016 22:39
screen and Docker for Mac
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty



screen -AmdS docker ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker
wget http://mirror.sdunix.com/gnu/emacs/emacs-24.5.tar.gz
tar zxvfp emacs-24.5.tar.gz
cd emacs-24.5/
./configure
sudo yum -y install libXpm-devel libjpeg-turbo-devel openjpeg-devel openjpeg2-devel turbojpeg-devel giflib-devel libtiff-devel gnutls-devel libxml2-devel GConf2-devel dbus-devel wxGTK-devel gtk3-devel
./configure
make
sudo make install
@13k
13k / foundation.go
Last active September 20, 2022 16:23
Accessing Foundation Framework from Go with cgo
// How to build: "CC=clang go build"
package main
import (
"fmt"
"net/url"
"strconv"
"unsafe"
)
@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
@ozbillwang
ozbillwang / Vagrant.Multi.CPU.rb
Created November 20, 2014 01:27
Vagrant setting - Use all CPU cores and 1/4 system memory
# http://www.stefanwrobel.com/how-to-make-vagrant-performance-not-suck
config.vm.provider "virtualbox" do |v|
host = RbConfig::CONFIG['host_os']
# Give VM 1/4 system memory & access to all cpu cores on the host
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
# sysctl returns Bytes and we need to convert to MB
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4