Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active June 30, 2024 17:55
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@ctrombley
ctrombley / httr_yahoo_oauth2_oob.R
Last active November 8, 2018 05:56
Working Yahoo OAuth2.0 OOB flow
# Requires httr fork available here:
# https://github.com/ctrombley/httr
library(httr)
library(httpuv)
endpoint <- oauth_endpoint("get_request_token", "request_auth", "get_token",
base_url = "https://api.login.yahoo.com/oauth2")
app <- oauth_app("yahoo",
@touilleMan
touilleMan / SimpleHTTPServerWithUpload.py
Last active June 16, 2024 01:51 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@AdamBrouwersHarries
AdamBrouwersHarries / Example wildcard makefile
Created January 6, 2014 18:18
An example makefile using wildcards and pattern substitution to compile a load of files of the same type
CPP_FILES = $(wildcard *.markdown)
OBJ_FILES = $(patsubst %.markdown,%.pdf,$(CPP_FILES))
%.pdf: %.markdown
pandoc -V geometry:margin=1in -S -o $@ $(patsubst %.pdf,%.markdown,$@)
all: $(OBJ_FILES)
clean:
@dhrrgn
dhrrgn / cmd.py
Last active May 17, 2021 18:41
Running a command in Python and optionally processing the output in realtime.
import shlex
import subprocess
import sys
def run_cmd(cmd, callback=None, watch=False):
"""Runs the given command and gathers the output.
If a callback is provided, then the output is sent to it, otherwise it
is just returned.
@ozh
ozh / gist:4131243
Created November 22, 2012 13:44
Create dot files/directories (ie .file) on Windows

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.