Skip to content

Instantly share code, notes, and snippets.

View adamlacombe's full-sized avatar
🧙‍♂️
I'm a wizard 🤯🤦🏼‍♂️

Mr. Potato Wizard adamlacombe

🧙‍♂️
I'm a wizard 🤯🤦🏼‍♂️
View GitHub Profile
@adamlacombe
adamlacombe / migrate-bitbucket-to-github.sh
Created June 9, 2024 09:36
This Bash script automates the migration of repositories from a Bitbucket organization to a GitHub organization, ensuring all branches and tags are transferred. It clones repositories with full mirroring, creates private repositories on GitHub, and pushes the content.
#!/bin/bash
# Bitbucket settings
BITBUCKET_USER=""
BITBUCKET_ORG=""
BITBUCKET_APP_PASSWORD=""
# GitHub settings
GITHUB_USER=""
GITHUB_ORG=""
This file has been truncated, but you can view the full file.
{"prompt":"Second arrest made in 2023 Bradenton home invasion\nBy ABC7 Staff\nPublished: Apr. 11, 2024 at 3:48 PM EDT | Updated: 3 hours ago\n\nBRADENTON, Fla. (WWSB) - Bradenton Police have arrested a second individual in connection with a 2023 home invasion.\n\nJames Reid, Jr., 29 was arrested in connection with the armed home invasion at a home in the 400-block of Cantabria Trail. Earlier this year, James Flowers was also arrested.\n\nPolice say on March 3, 2023, four individuals entered the victims residence, ransacked the home and stole jewelry, cash and a phone. Two adults and three children were in the house at the time. Reid is charged with armed home invasion. He is in custody at the Falkenberg Road Jail in Hillsborough County for unrelated charges. There are no immediate plans to transfer Reid to Manatee County.\n\nPolice have not released information on the other two individuals at this time.\n\nhttps://www.mysuncoast.com/2024/04/11/second-arrest-made-2023-bradenton-home-invasion/","completion":"{\
@adamlacombe
adamlacombe / cloudflare_zone_token_generator.sh
Last active February 29, 2024 07:04
This bash script automates the process of creating a Cloudflare API token with full zone permissions. It fetches all permission groups that have a scope related to zones. Once the appropriate permission groups are retrieved, the script creates a new API token with these permissions for a specific zone, which is defined by the ZONE_ID variable. A…
#! /bin/bash
# 1) Make file executable: chmod +x cloudflare_zone_token_generator.sh
# 2) Set variable values: API_KEY, EMAIL_ADDRESS, ZONE_ID
# 3) ./cloudflare_zone_token_generator.sh
# Global API Key: https://dash.cloudflare.com/profile/api-tokens
API_KEY=""
# Email address associated with your account
#!/bin/bash
# Check for jq and install if needed
if ! command -v jq &> /dev/null; then
echo "jq not found! Installing..."
sudo apt update && sudo apt install -y jq
echo "jq installed successfully!"
fi
DEFAULT_CONFIG_FILE="extensions.json"
@adamlacombe
adamlacombe / cloudflare-tunnel.sh
Created December 31, 2020 22:27
cloudflare tunnel
# https://developers.cloudflare.com/argo-tunnel/quickstart
cloudflared tunnel --hostname my.domain.com --url http://localhost:3338
docker run --name mysql -v /mysql-data:/var/lib/mysql -v /mysql:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=root -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql
@adamlacombe
adamlacombe / capitalize-names-in-csv.js
Last active December 18, 2020 19:51
Transform invite csv - capitalize name columns and lowercase emails
`First Name,Last Name,Email
john,doe,John.Doe@example.com
bobby,joe,Bobby.Joe@example.com`
.split('\n')
.map(r => r
.split(',')
.map((c, cIndex) => (cIndex === 2)
? c.toLowerCase()
: c.charAt(0).toUpperCase() + c.slice(1).toLowerCase())
.join(","))
@adamlacombe
adamlacombe / multiple-xlsx-to-single-csv.sh
Created December 17, 2020 23:18
Convert multiple xlsx files to csv files then merge multiple csv files into one
#!/bin/bash
# https://stackoverflow.com/a/21651707/9238321
for i in *.xlsx; do libreoffice --headless --convert-to csv "$i" ; done
# https://unix.stackexchange.com/a/558965
awk '(NR == 1) || (FNR > 1)' *.csv > all.csv
sudo apt-get install openssh-server
wget https://github.com/nanopool/nanominer/releases/download/v1.4.0/nanominer-linux-1.4.0.tar.gz
tar -xvzf ./nanominer-linux-1.4.0.tar.gz
cd nanominer-linux-1.4.0/
nano config.ini
./nanominer -d
wget --referer=http://support.amd.com https://drivers.amd.com/drivers/linux/amdgpu-pro-19.20-812932-ubuntu-18.04.tar.xz
@adamlacombe
adamlacombe / wsl2-replace-ip-in-hosts.ts
Created June 17, 2019 18:19
Replaces ip address in hosts file with the WSL2 container's ip
import * as shelljs from 'shelljs';
import * as fs from 'fs';
let modifyHosts = ['somehost.tld', 'testing.localdev'];
(shelljs.exec(`ip addr | grep "scope global eth0"`, {async: true}).stdout as any).on('data', (data) => {
if (data.includes('scope global eth0')) {
let ip = data.replace('inet ', '').split('/')[0].trim();
let hosts = fs.readFileSync("/mnt/c/Windows/System32/drivers/etc/hosts", {encoding: 'utf-8'})
.split('\n');