Skip to content

Instantly share code, notes, and snippets.

View peterfox's full-sized avatar

Peter Fox peterfox

View GitHub Profile
@innocenzi
innocenzi / ExampleComponent.vue
Last active March 30, 2022 08:51
Inertia route guards
<template>
<!-- ... -->
</template>
<script>
export default {
// ...
beforeRouteLeave (vm, options, event) {
// vm will now refer to this component instead of the link
return window.confirm(vm.$trans('ticket.confirm_leave_creation'));
@fesor
fesor / pre-commit
Last active March 16, 2022 06:12
php-cs-fixer pre-commit hook
#!/usr/bin/env bash
echo "php-cs-fixer pre commit hook start"
PHP_CS_FIXER="bin/php-cs-fixer"
PHP_CS_CONFIG=".php_cs"
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
if [ -n "$CHANGED_FILES" ]; then
$PHP_CS_FIXER fix --config "$PHP_CS_CONFIG" $CHANGED_FILES;
git add $CHANGED_FILES;
<?php
$browser->visit('Login')
->tap(
function (Browser $browser) {
$points = $browser->resolver->find("#TotalCount")->getText();
$this->mailer->send(
'mail',
['points' => $points],
function (Message $mailable) use ($browser, $points) {
$mailable->from('bot@pixelatedcrow.com', 'Pixelated Bot');
function progressGen(ProgressBar $bar, $itr)
{
$bar->start();
try {
foreach($itr as $k => $v) {
yield $k => $v;
$bar->advance();
}
} finally {
$bar->finish();
@mtigas
mtigas / 0-hidden-service-subdomains.md
Last active April 14, 2023 02:06
Example code for running a (HTTP/HTTPS) Tor hidden service supporting subdomains.

The following files show an example of how to create subdomains for onion site hidden services. (This hasn't been tested for hidden services for anything other than HTTP/HTTPS.)

(You might also want to read our blog post about ProPublica’s Tor hidden service, including a tutorial and notes on running a hidden service: https://www.propublica.org/nerds/item/a-more-secure-and-anonymous-propublica-using-tor-hidden-services )

In general, this works (maybe just in recent Tor clients) because Tor will handle the connection to www.xxxxxxxxxxxxxxxx.onion as a connection to xxxxxxxxxxxxxxxx.onion. The encapsulated HTTP/HTTPS connection contains the subdomain in the Host: header (and in the case of HTTPS, the SNI

@ttaubert
ttaubert / onion-gen.js
Created November 2, 2014 13:14
Generating custom .onion names with the WebCrypto API
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/*
* thirty-two
* https://github.com/chrisumbel/thirty-two
*
@ronanguilloux
ronanguilloux / pre-commit
Last active February 21, 2022 12:44 — forked from cjsaylor/pre-commit
phplint + phpcs + php-cs-fixer PHP-related pre-commit git hook (needs to add squizlabs/php_codesniffer & fabpot/php-cs-fixer to your composer.json)
#!/bin/sh
# @source: https://gist.github.com/ronanguilloux/11f6a788358577474ab4
# @link http://tech.zumba.com/2014/04/14/control-code-quality/
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: