Skip to content

Instantly share code, notes, and snippets.

View musteresel's full-sized avatar

Daniel Jour musteresel

View GitHub Profile
@aprell
aprell / jmp.c
Created March 1, 2012 17:34
Switching between coroutines/tasks: setjmp/longjmp (single stack)
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <setjmp.h>
#include <assert.h>
#include <unistd.h>
#include <time.h>
#include "list.h"
@rodw
rodw / backup-github.sh
Last active May 15, 2024 02:33
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
CFLAGS=`pkg-config --cflags dbus-1` -Wall
LDFLAGS=`pkg-config --libs dbus-1`
all: dbus-example
@cobyism
cobyism / gh-pages-deploy.md
Last active May 17, 2024 10:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@willurd
willurd / web-servers.md
Last active May 17, 2024 16:24
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active April 29, 2024 09:09
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@ostollmann
ostollmann / either.cxx
Last active August 29, 2015 14:06
Either monad in C++
#include <iostream>
#include <string>
#include <functional>
#include "either.hxx"
using std::cout;
using std::endl;
using std::string;
@Kagami
Kagami / github-proxy-ssh-tunnel-howto.md
Last active March 13, 2024 21:02
Using github through SSH tunnel
# Prerequisites: netcat-openbsd (BSD version of netcat)
$ ssh -fND 127.0.0.1:8081 user@<your-vps>
$ git config --global url."https://github".insteadOf git://github
$ git config --global http.proxy 'socks5://127.0.0.1:8081'
$ echo -e 'Host github.com\nProxyCommand nc -x 127.0.0.1:8081 %h %p' >> ~/.ssh/config

Alternative solutions:

@ishu3101
ishu3101 / gist_to_github_repo.md
Created November 24, 2015 08:35
Transfer a gist to a GitHub repository

Transfer a gist to a GitHub repository

clone the gist

git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9

rename the directory

mv 6fb35afd237e42ef25f9 ConvertTo-Markdown

change the working directory to the newly renamed directory

cd ConvertTo-Markdown