Skip to content

Instantly share code, notes, and snippets.

View mislav's full-sized avatar

Mislav Marohnić mislav

View GitHub Profile
nat /
Last active December 7, 2020 05:33
Authenticate with GitHub from Python using the new device auth flow
#!/usr/bin/env python3
# Implements the GitHub device auth flow described here:
from urllib.parse import parse_qs
import urllib, requests, time, webbrowser, json
client_id ='a945f87ad537bfddb109'
swinton /
Last active May 14, 2024 10:06
Automatically sign your commits from GitHub Actions, using the REST API

Verified commits made easy with GitHub Actions


So you want to commit changes generated by a GitHub Actions workflow back to your repo, and have that commit signed automatically?

Here's one way this is possible, using the REST API, the auto-generated GITHUB_TOKEN, and the GitHub CLI, gh, which is pre-installed on GitHub's hosted Actions runners.

You don't have to configure the git client, just add a step like the one below... Be sure to edit FILE_TO_COMMIT and DESTINATION_BRANCH to suit your needs.

imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
sjl / ext.vim
Created December 15, 2014 18:58
ways to run external commands in vim
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
tpope / githubmail.rb
Created March 19, 2014 01:00
Add a gmail label to all closed issues where I the tpope last commented
require 'gmail'
require 'github_api'
require 'netrc'
require 'pry'
netrc =
github = netrc[''].join(':'))*netrc['']) do |gmail|
gmail.inbox.emails(from: '').each do |message|
martijnvermaat /
Created December 21, 2013 15:06
SSH agent forwarding and screen

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

jasonrudolph /
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
stympy / campfire.rb
Last active December 18, 2015 10:09
Easy post to a campfire room using faraday
class Campfire
def initialize(domain, token)
@client = => "https://#{domain}") do |faraday|
faraday.basic_auth(token, 'X')
faraday.request :url_encoded
faraday.adapter Faraday.default_adapter
def speak(room, message)
sstephenson / Simple
Created April 11, 2013 23:48
Simple file/stream encryption using OpenSSL

Simple file/stream encryption using OpenSSL

Create and store a 512-byte random encryption key named secret:

$ mkkey secret

Encrypt the contents of file with the secret key and write it to file.enc:

$ encrypt secret < file > file.enc
sstephenson / super.bash
Last active January 30, 2017 01:40
`super` in Bash
#!/usr/bin/env bash
source super.bash
foo() {
echo hello
super_function foo
foo() {