Skip to content

Instantly share code, notes, and snippets.

View lil5's full-sized avatar

Lucian I. Last lil5

View GitHub Profile
@m33x
m33x / hass.js
Last active April 27, 2024 22:35
Simple Home Assistant (HASS) iOS Widget via Scriptable App
let widget = await createWidget();
if (!config.runsInWidget) {
await widget.presentSmall();
}
Script.setWidget(widget);
Script.complete();
async function createWidget(items) {
@gcangussu
gcangussu / jest-resolver.js
Last active October 31, 2023 15:06
Custom Jest resolver to preserve symlinks. Useful for usage with Bazel. Requires `resolve` npm package.
const resolve = require('resolve');
/**
* @typedef {{
basedir: string;
browser?: boolean;
defaultResolver: (request: string, options: ResolverOptions) => string;
extensions?: readonly string[];
moduleDirectory?: readonly string[];
paths?: readonly string[];

Preact + Material-UI example

Preact is a fast 3kB alternative to React with the same modern API.

This example uses shows how to use Material UI 4 with Preact X and Preact CLI 3.

How to use

git clone blah preact-mui
@darcyliu
darcyliu / files.go
Last active April 7, 2024 04:01
WebDAV server in go
// go get golang.org/x/net/webdav
// go run files.go -openbrowser -http=127.0.0.1:9090
package main
import (
"context"
"flag"
"net/http"
"log"
"fmt"
@lil5
lil5 / docker-compose.yml
Created May 16, 2018 07:52
Nextcloud on Docker with self cert HTTPS using omgwtfssl
version: '3'
services:
db:
image: mariadb
restart: unless-stopped
volumes:
- /mnt/data/mysql:/var/lib/mysql
env_file:
- db.env
@ckunte
ckunte / Makefile
Last active June 22, 2021 01:15
Makefile for backups
# Makefile for backup routines
# 2021 ckunte
#
SOURCE=/home/Chyetanya.Kunte
# current (and archived) projects
PROJECTS=prj
# past projects
REFERENCES=ref
# Here's an example: make cprj IP="10.0.1.19"
# ref: https://stackoverflow.com/questions/15500204/
#if placed at the end of your .zshrc this wil automaticly start and attach tmux.
#When you attach from a new session, it wil close your previous terminal.
#start tmux defaultly
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux a -d || tmux new-session)
fi
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@retr0h
retr0h / gist:11018218
Last active November 21, 2018 06:40
self signed cert

Creating a self-signed CA

$ openssl req -new -x509 -nodes -days 365 -out CA.crt -keyout CA.key -subj '/CN=Test CA'
$ openssl req -new -nodes -out cert.req -keyout cert.key -subj '/CN=*.openstack.local'
$ openssl x509 -req -in cert.req -CA CA.crt -CAkey CA.key -CAcreateserial -days 365 -out cert.crt

View the expiration date for an x509 certificate. Unless passing the -days flag when creating the CA cert, it will default to '30', as defined by the default_crl_days option in /etc/ssl/openssl.cnf.

$ openssl x509 -text -in CA.crt
@ksafranski
ksafranski / Common-Currency.json
Last active April 22, 2024 15:16
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},