Skip to content

Instantly share code, notes, and snippets.

@trasherdk
trasherdk / js-encryption.md
Last active November 3, 2024 02:19 — forked from pilcrowonpaper/js-encryption.md
Encrypting data with AES128 in JavaScript

Encrypting data with AES128 in JavaScript

Usage

AES128 uses a 16 byte secret key.

const key = new Uint8Array(16);
crypto.getRandomValues(key);
@trasherdk
trasherdk / README.md
Created April 12, 2023 01:01 — forked from joshnuss/README.md
Prisma snippets

Prisma Snippets

For ViM and VSCode.

Commands

  • model<tab>: defines a model
  • field<tab>: defines a field
  • index<tab>: defines an index
  • unique: defines a unique index
<VirtualHost *:443>
ServerName centos.installer
DocumentRoot "/var/www"
## Directories, there should at least be a declaration for /var/www
<Directory "/var/www">
Options SymLinksIfOwnerMatch
@trasherdk
trasherdk / gist:16c9a07a95e3cefe9f6b5d3ea3de24b8
Created October 28, 2021 04:19 — forked from miohtama/gist:5216738
Enabling SSLCACertificateFile and SSLVerifyClient for one page only in Apache 2.2+
# Apache configuration for running local browser against a locally running xxxx for manual smartcard testing
# Listen 4433
<VirtualHost 127.0.0.1:4433>
# Real men use mod_proxy
DocumentRoot "/nowhere"
ServerName local-apache
ServerAdmin [email protected]
@trasherdk
trasherdk / authproxy.erb
Created October 28, 2021 04:08 — forked from dalen/authproxy.erb
PuppetDB filtering proxy Requires jq 1.3+ and mod_ext_filter in apache
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName <%= @fqdn %>:8080
SSLEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ALL:!ADH:!RC4:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXP:!RC2
SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/<%= @fqdn %>.pem
@trasherdk
trasherdk / .appendTo_apache2.conf
Created October 28, 2021 03:41 — forked from shijij/.appendTo_apache2.conf
Apache BasicAuth with MySQL (authn_dbd)
# Append to apache2.conf
# Dont forget to repalce [user] [password] [dbname] with you own info
# ref: https://httpd.apache.org/docs/2.4/mod/mod_dbd.html
# ref: https://httpd.apache.org/docs/2.4/mod/mod_authn_dbd.html
<IfModule mod_authn_dbd.c>
DBDriver mysql
DBDParams host=localhost,port=3306,user=apache,pass=apache,dbname=auth
DBDMin 2
DBDKeep 8
@trasherdk
trasherdk / get-latest-tag-on-git.sh
Created December 22, 2020 04:12 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@trasherdk
trasherdk / gist:45b750cede99b32ac940aa1005d0a07c
Created December 22, 2020 04:12 — forked from steveclarke/gist:1411146
Git: Setting up a Remote Repository and Doing Initial Push

Setup remote repository:

ssh [email protected]
mkdir my_project.git
cd my_project.git
git init --bare

On local machine:

cd my_project

<?php
// The URL where the test-auth.php script resides.
define("POST_DATA_TO_URL", "http://someurl/my-script.php");
// Function to send value to my-script.php script via cURL with digest authentication.
function submitValue($myValue) {
$ch = curl_init(POST_DATA_TO_URL);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "admin:mypass");
@trasherdk
trasherdk / README.md
Last active December 19, 2018 12:35 — forked from andredumas/.gitignore
TechanJS Server Side Generation

Demonstrates chart generation on both server side (top chart) using node.js and client side (bottom chart).

Note: For the purpose of this example and not having node.js available servers side, chart.svg has been pre generated using instructions for this project:

npm install
node index.js > chart.svg