Skip to content

Instantly share code, notes, and snippets.

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active November 16, 2024 22:55
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@tonyg
tonyg / MediaPlayer2-cmd
Created June 27, 2016 18:01
Use DBus to control whichever DBus-compatible media player happens to be running.
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage: MediaPlayer2-cmd { PlayPause | Next | Previous | Stop | ... }"
exit 1
fi
tried_starting_something=false
@xlab
xlab / bytes_split.go
Last active April 4, 2022 17:21
Golang split byte slice in chunks sized by limit
func split(buf []byte, lim int) [][]byte {
var chunk []byte
chunks := make([][]byte, 0, len(buf)/lim+1)
for len(buf) >= lim {
chunk, buf = buf[:lim], buf[lim:]
chunks = append(chunks, chunk)
}
if len(buf) > 0 {
chunks = append(chunks, buf[:len(buf)])
}
@imjasonh
imjasonh / markdown.css
Last active November 6, 2024 14:26
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 30, 2024 19:38
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@chrisgillis
chrisgillis / ssl_smtp_example.go
Created April 16, 2014 14:48
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
(defun extract-translation (start end)
(interactive "r")
(if (region-active-p)
(let* ((text (buffer-substring start end))
(keyname (read-string "Key name: " (extract-translation-default-key-name text)))
(short-keyname (car (last (split-string keyname "\\.") 1)))
(rails-root (if (fboundp 'ffip-project-root)
(ffip-project-root)
(projectile-project-root)))
@antespi
antespi / HowTo: Decode base64
Created November 6, 2013 17:07
HowTo: Decode/Encode base64 using OpenSSL
Decode
======
openssl enc -base64 -d <<< SGVsbG8sIFdvcmxkIQo=
Encode
======
openssl enc -base64 <<< 'Hello, World!'
@richardgv
richardgv / skippy-xd-wip.patch
Last active December 22, 2015 02:39
richardgv/skippy-xd: Work in progress (icon rendering)
diff --git a/Makefile b/Makefile
index 12fbe8e..81d25db 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ BINDIR ?= ${PREFIX}/bin
CC ?= gcc
-SRCS_RAW = skippy wm dlist mainwin clientwin layout focus config tooltip img
+SRCS_RAW = skippy wm dlist mainwin clientwin layout focus config tooltip img img-xlib