Skip to content

Instantly share code, notes, and snippets.

View selftaught's full-sized avatar

selftaught selftaught

  • Bluehost
  • Portland
View GitHub Profile
#!/usr/bin/env perl
# This can be used as part of git pre-commit hooks without the need to install deps
# because FindBin and File::Find are core perl. We use this in .husky/pre-commit.
# This runs on Mac OS, Linux, and WSL
use strict;
use warnings;
use feature 'say';
use FindBin qw($Bin);
use File::Find;
@selftaught
selftaught / unbarrel-imports.sh
Last active August 25, 2023 01:31
MUI barrel imports to direct imports
#!/usr/bin/env bash
function _sed() {
if [ `uname` = 'Darwin' ]; then
# for MacOS
sed -i '' -e "$1" "$2"
else
# for Linux and Windows
sed -i'' -e "$1" "$2"
fi
#!/bin/bash
rm -rf plugins
mkdir plugins
for i in $(seq 1 2); do
curl -s "https://wordpress.org/plugins/browse/popular/page/$i/" | \
grep --color "https://wordpress.org/plugins/" | \
grep "<h3 class=\"entry-title\">" | sed "s/.*a href=\"//g" | sed "s/\" rel.*//g" | \
xargs -I{} curl -s {} | grep downloadUrl | grep -Eo "https:[^\"]+" | \
Bash PowerShell Bash Example PowerShell Example
find Get-ChildItem find . -type f -name "matchme" Get-ChildItem -Filter "matchme" -Recurse -File
ls Get-ChildItem ls -R dir/ Get-ChildItem '.\dir' -Recurse
which Get-Command which python Get-Command python
env Get-ChildItem env: env Get-ChildItem env:
echo echo echo $ENV{'PATH'} echo $Env:path
grep Select-String grep 'foobar' file.txt Select-String -Path '.\file.txt'-Pattern 'foobar'
useradd
@selftaught
selftaught / GoogleDorking.md
Created January 14, 2021 07:00 — forked from sundowndev/GoogleDorking.md
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"

My Openshift Cheatsheet

Openshift build secrets for cloning git repos using SSH Keys

  • To create ssh secret:
oc create secret generic sshsecret \
    --from-file=ssh-privatekey=$HOME/.ssh/id_rsa
@selftaught
selftaught / nginx.conf
Created March 17, 2020 19:50 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@selftaught
selftaught / bw.c
Last active November 17, 2019 16:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
void print_bits (uint8_t vals);
void bitwise_and ();
void bitwise_and_assign ();
void bitwise_or ();
void bitwise_or_assign ();
@selftaught
selftaught / dotfiles
Created November 9, 2019 23:19 — forked from rosghub/dotfiles
Manjaro i3 Hi-DPI config
#
# Configuration files for Manjaro i3 on Lenovo Yoga 2 pro
# to scale properly on HiDPI (3200x1800)
#
#####################################################
~/.profile #
#####################################################
# UI element scaling, icons
export GDK_SCALE=2