Skip to content

Instantly share code, notes, and snippets.

@cshaa
cshaa / .XCompose
Last active September 7, 2024 11:16
Unicode emoticons for Compose key
# Emoji
# http://unicode.org/emoji/charts/full-emoji-list.html
<Multi_key> <e> <m> <o> <colon> <D> : "😀"
<Multi_key> <e> <m> <o> <x> <D> : "😁"
<Multi_key> <e> <m> <o> <x> <apostrophe> <D> : "😂"
<Multi_key> <e> <m> <o> <colon> <apostrophe> <D> : "😂"
<Multi_key> <e> <m> <o> <r> <o> <f> <l> : "🤣"
<Multi_key> <e> <m> <o> <colon> <d> : "😃"
<Multi_key> <e> <m> <o> <x> <parenright> : "😄"
@raorao
raorao / ets_cache.ex
Last active October 21, 2024 19:20
Simple ETS based cache with TTL
defmodule RequestCache do
@moduledoc """
Simple ETS-based cache.
"""
use GenServer
@type t :: %{ttl: integer, invalidators: %{}}
@type cache_key :: any
@type cache_value :: any
# pylint: disable=E0401,E1002
import array
import functools
import dbus
import dbus.exceptions
import dbus.mainloop.glib
import dbus.service
import pprint
try:
from gi.repository import GObject as gobject
@r0ckarong
r0ckarong / whitelist.txt
Last active May 24, 2023 22:09
Pi-Hole Whitelist
adaway.org
api.twitter.com
bitbucket.org
changelogs.ubuntu.com
de.ign.com
dl.google.com
dmp.adform.net
dropbox.com
feedly.com
gearbest.com
@rcarmo
rcarmo / gradient.py
Last active July 30, 2018 17:40
Elegant Python RGB/RGBA multi-step linear gradients with generators
#!/usr/bin/env python3
from itertools import tee
# colors are floating-point 3-element tuples (doing RGBA is a matter of setting the component count)
def poly_gradient(colors, steps, components=3):
def linear_gradient(start, finish, substeps):
yield start
for i in range(1, substeps):
@JulianKingman
JulianKingman / meteordockersetup.yml
Last active September 7, 2017 05:43
Docker setup, with SSL
nginx-proxy:
image: 'jwilder/nginx-proxy'
ports:
- '80:80'
- '443:443'
volumes:
- '/path/to/certs:/etc/nginx/certs:ro'
- '/etc/nginx/vhost.d'
- '/usr/share/nginx/html'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
@bench
bench / update-alternatives-golang.sh
Last active November 17, 2024 19:43
update-alternatives golang
#!/bin/bash
#
# Use the following script using sudo to install multiple golang installations on your debian
# update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system
# Usage : sudo ./full_golang_install.sh
#
if [[ $(id -u) -ne 0 ]] ; then echo "This script should be run using sudo or as the root user" ; exit 1 ; fi
## Configuration and init
@theothermattm
theothermattm / sync-using-gitignore.sh
Created October 7, 2015 20:58
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@ChaunceyHoover
ChaunceyHoover / sleep.lua
Last active January 26, 2023 16:17
Lua asynchronous and synchronous sleeping
function sleep(time, func, ...)
local now = os.time()
local thread = coroutine.create(func)
repeat until (os.time() - now > time)
coroutine.resume(thread, ...)
end
function asleep(time, func, ...)
coroutine.wrap(function()
local now = os.time()
@herval
herval / stackfile.yml
Last active May 13, 2016 05:00
Daily Postgres Backup from Tutum to S3
backup:
image: 'borja/dockup:latest'
environment:
- AWS_ACCESS_KEY_ID=<SET ME>
- AWS_DEFAULT_REGION=<SET ME>
- AWS_SECRET_ACCESS_KEY=<SET ME>
- BACKUP_NAME=<SET ME>
- PATHS_TO_BACKUP=/var/lib/postgresql/data
- S3_BUCKET_NAME=<SET ME>
restart: on-failure