Skip to content

Instantly share code, notes, and snippets.

View TaylorHawkes's full-sized avatar

Taylor Hawkes TaylorHawkes

View GitHub Profile
@TaylorHawkes
TaylorHawkes / itemset-python.py
Created January 17, 2023 19:16
itemset python
import numpy as np
# make matrix with numpy
A = np.matrix('[6, 1; 2, 3]')
# applying matrix.itemset() method
A.itemset((1, 0), 5)
print(A)
[[6, 1]
[5, 3]]
@TaylorHawkes
TaylorHawkes / inotifywait-alpine.sh
Created January 17, 2023 19:16
inotifywait alpine
apk add inotify-tools
@TaylorHawkes
TaylorHawkes / datalist-onclick.js
Created January 17, 2023 19:17
datalist onclick
$(document).on('change', 'input', function(){
var options = $('datalist')[0].options;
var val = $(this).val();
for (var i=0;i<options.length;i++){
if (options[i].value === val) {
alert(val);
break;
}
}
});
@TaylorHawkes
TaylorHawkes / awk-cursor.sh
Created January 17, 2023 19:17
awk cursor
## Customer Functions for manipulating screen cursor from awk
function CURSOR_CLS() {printf "\033[2J"} #Clear full screen and move cursor to 0,0
function CURSOR_ERASE() {printf "\033[K"} #Clear current line
function CURSOR_SAVE() {printf "\033[s"} #Save cursor position
function CURSOR_RESTORE() {printf "\033[u"} #Restore cursor position back to last save
function CURSOR_SET(LINE,COLUMN) {printf "\033["LINE";"COLUMN"H"} #Set cursor to row,column position
function CURSOR_UP(NUM) {printf "\033["NUM"A"} #Move cursor up x rows
function CURSOR_DOWN(NUM) {printf "\033["NUM"B"} #Move cursor downn x rows
function CURSOR_RIGHT(NUM) {printf "\033["NUM"C"} #Move cursor right x columns
function CURSOR_LEFT(NUM) {printf "\033["NUM"D"} #Move cursor left x columns
@TaylorHawkes
TaylorHawkes / clipboard-history-ubuntu.sh
Created January 17, 2023 19:17
clipboard history ubuntu
sudo apt install gnome-shell-extensions-gpaste
@TaylorHawkes
TaylorHawkes / passer-une-liste-en-parametre-python.py
Created January 17, 2023 19:17
passer une liste en parametre python
def toto(*a):
print a
for i in range(len(a)):
print a[i]
 
toto('x', 'y', 'z', 't')
('x', 'y', 'z', 't')
x
y
z
@TaylorHawkes
TaylorHawkes / laravel-com-wherein.php
Created January 17, 2023 19:17
laravel.com wherein
DB::table('user')->whereIn('id', [100,200])->get();
$users = User::whereIn('id', array(1, 2, 3))->get();
@TaylorHawkes
TaylorHawkes / set-cookie-cannot-modify-header-information-headers-already-sent-by.txt
Created January 17, 2023 19:17
set cookie cannot modify header information - headers already sent by
@TaylorHawkes
TaylorHawkes / how-to-create-user-activity-logs-in-php.php
Created January 17, 2023 19:17
how to create user activity logs in php
<?php
// Include the database configuration file
include_once 'dbconfig.php';
// Get current page URL
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$user_current_url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'];
@TaylorHawkes
TaylorHawkes / typescript-redirect-with-reload-page.txt
Created January 17, 2023 19:17
typescript redirect with reload page
redirection(){
window.location.href="yourpagedomain/login"
}