Skip to content

Instantly share code, notes, and snippets.

View anton-roos's full-sized avatar
🎯
Focusing

Anton Roos anton-roos

🎯
Focusing
View GitHub Profile
@anton-roos
anton-roos / git-config.sh
Created August 13, 2022 07:38
git-config
# Set local git config
git config user.name "Your Name Here"
git config user.email your@email.example
# Set global git config
git config --global user.name "Your Name Here"
git config --global user.email your@email.example
# Check your git settings
git config user.name && git config user.email
@anton-roos
anton-roos / unlike-all-tweets.js
Last active April 9, 2022 13:35
Bulk unlike tweets with JavaScript
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function unlikeTweets() {
let tweets = document.querySelectorAll('[data-testid="tweet"]');
for (let tweet of tweets) {
let unlikeButton = tweet.querySelectorAll('[data-testid="unlike"]')[0];
if (unlikeButton != null) {
unlikeButton.scrollIntoView();
unlikeButton.click();
@anton-roos
anton-roos / delete-my-tweets-from-tweets-and-replies.js
Created April 9, 2022 13:02
Delete your tweets from Tweets & replies with JavaScript
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function deleteTweets() {
let tweets = document.querySelectorAll('[data-testid="tweet"]');
for (let tweet of tweets) {
// Replace "Your Display Name"
if (tweet.querySelector("span:first-child").innerHTML.includes("Your Display Name")) {
console.log("My tweet");
tweet.querySelectorAll('[data-testid="caret"]')[0].scrollIntoView();
@anton-roos
anton-roos / latest-commit-by-branch.sh
Created June 10, 2020 10:14
Get all latest commits per branch sort by latest commit after git pull.
git pull
echo "Git pull done, fetching timetable..."
for branch
in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch;
done | sort -r
@anton-roos
anton-roos / update-stock-status.sql
Created May 25, 2020 14:56
Update stock status of WooCommerce products.
UPDATE wp_postmeta
SET `meta_value` = 'outofstock'
WHERE `meta_value` = 'instock'
AND `meta_key` = '_stock_status'
@anton-roos
anton-roos / select-products-no-featured-image.sql
Created May 25, 2020 14:53
Select WordPress Posts or WooCommerce Products with no featured image.
@anton-roos
anton-roos / count-duplicate-skus.sql
Created May 25, 2020 14:51
Count duplicate WooCommerce Products SKUs
SELECT `meta_value`, `meta_key`, count(*)
FROM wp_postmeta WHERE meta_key LIKE '_sku'
GROUP BY `meta_value`
ORDER BY `count(*)` DESC
@anton-roos
anton-roos / select-duplicate-skus.sql
Last active May 25, 2020 14:41
Select duplicate SKUs from WooCommerce database.
SELECT meta_value
FROM wp_postmeta
WHERE meta_key = '_sku'
AND meta_value != ''
GROUP BY meta_value HAVING COUNT(meta_value) > 1
@anton-roos
anton-roos / update-sold-individually.sql
Last active May 25, 2020 14:47
Update Sold Individually of all WooCommerce products.
UPDATE `wp_postmeta`
SET `meta_value` = 'no'
WHERE `meta_key` = '_sold_individually'
@anton-roos
anton-roos / update-manage-stock.sql
Last active May 25, 2020 14:48
Updtate all WooCommerce Products to "Mange Stock"
UPDATE `wp_postmeta`
SET `meta_value` = 'yes'
WHERE `meta_key` = '_manage_stock'