Skip to content

Instantly share code, notes, and snippets.

import React, { useContext, useState } from 'react';
function useCounterContext() {
const [counter, setCounter] = useState(0);
return {
counter,
setCounter,
} as const;
}
@GuiSevero
GuiSevero / git_merge_repos.sh
Created July 28, 2020 12:01 — forked from lloeki/git_merge_repos.sh
Merge repos and keep whole history by creating a single multi-parent merge commit
#!/bin/bash
set -e
set -u
set -o pipefail
prefix="[email protected]:mygroup"
target="$1"
shift
@GuiSevero
GuiSevero / sass-7-1-pattern.scss
Created August 16, 2019 19:55 — forked from rveitch/sass-7-1-pattern.scss
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
echo "Patch file controller.sh"
TEMP_FILE=$(mktemp)
echo<<EOF >$(TEMPFILE)
8c8
< JAVA_TOOL=${JRE_HOME}/bin/java
---
> JAVA_TOOL=java
68c68
< ${PORTT_TOOL} 127.0.0.1 8088 500
---
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run using sudo or as the root user."
exit 1
fi
echo "EAP Controller on Raspberry Pi"
echo "=============================="
echo "Author: Arthur Gay <[email protected]>"
unbindall
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "9" "slot9"
bind "a" "+moveleft"
bind "b" "buymenu"

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@GuiSevero
GuiSevero / gordy.cfg
Created September 24, 2016 19:49
csgo cfg
unbindall
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "9" "slot9"
bind "a" "+moveleft"
bind "b" "buymenu"
@GuiSevero
GuiSevero / svn stash.txt
Created July 25, 2016 19:56
SVN "git stash" alternative
set PATH=%PATH%;C:\Program Files\TortoiseSVN\bin
git stash: svn diff > patch_name.patch; svn revert -R .
git stash apply: patch patch_name.patch
based on stackoverflow answer: http://stackoverflow.com/questions/1554278/temporarily-put-away-uncommited-changes-in-subversion-a-la-git-stash
@GuiSevero
GuiSevero / baseurl.php
Created December 19, 2014 17:42
PHP BaseUrl Function
<?php
function curPageURL()
{
preg_match('/index.php[\/]*(.*)/', ( ! empty($_SERVER['SUPHP_URI'])) ? $_SERVER['SUPHP_URI'] : $_SERVER['PHP_SELF'], $match);
$protocol = (isset($_SERVER['HTTPS'])) ? 's' : '';
$base_url = preg_split("/\?/", str_ireplace(((isset($match[1])) ? trim($match[1], '/') : ''), '', urldecode(trim((( ! empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '/'), '/'))));
$port = (isset($_SERVER['SERVER_PORT']) AND $_SERVER['SERVER_PORT'] != 80) ? ':'.$_SERVER['SERVER_PORT'] : '';
$url = trim(sprintf("http".$protocol."://%s/%s", (( ! empty($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost'.$port), reset($base_url)),'/') . '/';
return $url;
}