Skip to content

Instantly share code, notes, and snippets.

View bluetechy's full-sized avatar

bluetechy

  • Unicity International
  • Orem, UT
View GitHub Profile
@bluetechy
bluetechy / BrowserLikeTabs.js
Created February 1, 2023 06:08 — forked from Rahul-RB/BrowserLikeTabs.js
Dynamically add and remove tabs in Material UI (Browser tabs feature)
/* No licenses, use as pleased.
* The code here uses React Class components (ES6 classes).
* Ken Nguyen has made a hooks version of this! Please find that here: https://codesandbox.io/s/addanddelete-tabs-mui-bo7tw
* Cheers!
*/
import React, { Component } from "react";
import {
withStyles,
AppBar,
@bluetechy
bluetechy / pbcopyfy
Created November 7, 2022 10:41 — forked from garywoodfine/pbcopyfy
Simple Script to configure pbcopy like functionality on ubuntu
#!/bin/sh
# Copyright (C) 2009-2017 Three Nine Consulting
# Always good practice to update packages. However ask user if they would like to do so
# For explanation on how this works and why check out https://garywoodfine.com/use-pbcopy-on-ubuntu/
read -p "Do you want to update your package repositories before proceeding ? " -n 1 -r
echo #adding new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt update
sudo apt upgrade -y
@bluetechy
bluetechy / merge
Created November 21, 2020 01:09 — forked from tmiller/merge
Bash script to merge master into all branches
#!/bin/bash
# Merges the master branch into all other branches
#
# Process:
#
# - Save the name of the current branch
# - If the current branch is not master then checkout master.
# - Pull the latest changes for master from its upstream branch.
# - Loop over each local branch.
@bluetechy
bluetechy / Component.jsx
Created November 11, 2020 06:57 — forked from krambertech/Component.jsx
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();
@bluetechy
bluetechy / ngrx8_with_immer.ts
Created October 17, 2020 06:31 — forked from born2net/ngrx8_with_immer.ts
ngrx 8+ with immer and support for on() within reducer
import {createReducer} from '@ngrx/store';
import {on} from "@ngrx/store";
import produce, {Draft} from "immer";
export const initialUserState: IUserState = {
knownUsers: [user1, user2],
selectedUser: null,
scenes: null
};
@bluetechy
bluetechy / GitHub curl.sh
Created July 29, 2020 03:36 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@bluetechy
bluetechy / gist:4c214d415bcef8c02bc4a8483d3fc4c9
Created July 28, 2020 08:54 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
<?php
// generate private/public key as follows:
// > openssl genrsa -out private.pem 2048
// > openssl rsa -in private.pem -outform PEM -pubout -out public.pem
$data = "String to encrypt";
$privKey = openssl_pkey_get_private('file:///path/to/private.pem');
$encryptedData = "";
@bluetechy
bluetechy / nginxproxy.md
Created April 6, 2019 05:45 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

FROM centos:7
MAINTAINER Naoaki Obiki
RUN yum update -y
RUN yum group install -y 'Development Tools'
RUN yum install -y libxml2-devel wget
RUN wget "http://jp2.php.net/get/php-7.0.9.tar.gz/from/this/mirror" -P /usr/local/src/
RUN mv /usr/local/src/mirror /usr/local/src/php-7.0.9.tar.gz
RUN wget "http://pecl.php.net/get/pthreads-3.1.6.tgz" -P /usr/local/src/