Skip to content

Instantly share code, notes, and snippets.

@joshnuss
joshnuss / httpStore.js
Last active October 11, 2023 11:29
A Svelte store backed by HTTP
import { writable } from 'svelte/store'
// returns a store with HTTP access functions for get, post, patch, delete
// anytime an HTTP request is made, the store is updated and all subscribers are notified.
export default function(initial) {
// create the underlying store
const store = writable(initial)
// define a request function that will do `fetch` and update store when request finishes
store.request = async (method, url, params=null) => {
@khongi
khongi / .env
Last active February 19, 2024 02:37
Sonarr + Radarr + Jackett + qBittorrent + ddclient cloudflare DNS update + Traefik reverse proxy with LetsEncrypt on Docker
QBITTORRENT_PATH=<PATH>
QBITTORRENT_WEBUI_PORT=<PORT>
DOWNLOAD_PATH=<PATH>
MEDIA_PATH=<PATH>
JACKETT_PATH=<PATH>
SONARR_PATH=<PATH>
RADARR_PATH=<PATH>
DOMAIN=<YOUR DOMAIN>
TZ=<Timezone e.g. Europe/Budapest>
USERDIR=<HOME DIR PATH>
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active June 21, 2023 07:03
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
@mikepruett3
mikepruett3 / shell-setup.ps1
Last active April 15, 2024 00:33
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@jsidhu
jsidhu / ansible_ssl_cert.yaml
Created March 15, 2017 05:14
Ansible snippet to create a self signed ssl certificate
# - name: Generate DH Params (may take several minutes!)
# command: openssl dhparam \
# -out "/data/jenkins_home/ssl/dhparam.pem" 2048
# args:
# creates: "/data/jenkins_home/ssl/dhparam.pem"
#
# - name: Generate ECC Key
# command: openssl ecparam \
# -genkey \
# -name prime256v1 \
@fulv
fulv / main.yml
Last active August 31, 2023 09:06
Ansible - Creating users and copying ssh keypair files to the remote server
Put this in your `local-configure.yml` file, add as many users as you need:
users:
- name: fulvio
sudoer: yes
auth_key: ssh-rsa blahblahblahsomekey this is actually the public key in cleartext
- name: plone_buildout
group: plone_group
sudoer: no
auth_key: ssh-rsa blahblahblah ansible-generated on default
@mvaneijgen
mvaneijgen / Scale resolution.scpt
Last active March 26, 2023 10:46
Change screen resolution AppleScript
local index1, index2
set index1 to 3 -- 1920 x 1200
set index2 to 4 -- 1280 x 800
-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
@alexandregz
alexandregz / .profile
Last active May 27, 2016 22:32
to add to .profile (ash shell used with Synology NAS)
# place to git, ipkg, another shell commands
PATH=/volume1/@optware/bin:$PATH
export PATH
# more useful prompt shell
#PS1="`hostname`> "
PS1='\u@\h:\w'
case `id -u` in
0) PS1="${PS1}# ";;
@fpirsch
fpirsch / toHaveClass.js
Created September 30, 2014 14:02
Protractor/jasmine toHaveClass custom matcher
/**
* Custom "toHaveClass" matcher.
*
* Based on https://gist.github.com/darthwade/9305669
* and https://gist.github.com/elgalu/94284ec0ac3e8a590507
*
* usage :
* require('./toHaveClass.js');
* ...
* expect($('html')).toHaveClass('wf-active');
@scudelletti
scudelletti / chai_custom_matcher.js
Created July 24, 2014 20:35
Chai Custom Matcher
/*
Chai - Add CustomMatchers
usage:
var CustomMatchers = require('./support/friendly_news_path_matcher');
chai.use(CustomMatchers);
expect('/materia/FooBar').to.be.a.friendlyNewsPath();
*/