Skip to content

Instantly share code, notes, and snippets.

@jmakeig
jmakeig / split-json-array.sh
Last active March 23, 2023 15:43
Split a file containing a JSON Array into one file per item
#!/usr/bin/env bash
# Splits a file that contains a top-level JSON Array
# into individual files, one per item, named sequentially
# https://stedolan.github.io/jq/download/
jq -c .[] "$1" | awk '{print > (NR ".json")}'
@amalmurali47
amalmurali47 / README.md
Created May 1, 2019 18:31
Delete all Telegram contacts.

How to delete all your Telegram contacts at once?

  1. Go to https://web.telegram.org and sign in if you're not already signed in.
  2. On the top-left, click on the hamburger icon to show the dropdown menu, and choose "Contacts" from the list.
  3. Choose "Edit".
  4. Open the Developer Console of your browser (preferably Chrome or Firefox). On Chrome, that is Ctrl + Shift + J.
  5. Run the following JS snippet:
var x = document.getElementsByClassName('contacts_modal_contact')
#facebook marketplace
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from pymongo import MongoClient
class App:
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@phlbnks
phlbnks / products_with_category.sql
Last active December 18, 2020 23:11
Select Product name, SKU, price and category from WordPress / WooCommerce with MySQL query
SELECT
wp_posts.post_title AS Product,
wp_postmeta1.meta_value AS SKU,
wp_postmeta2.meta_value AS Price,
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories
FROM wp_posts
LEFT JOIN wp_postmeta wp_postmeta1
ON wp_postmeta1.post_id = wp_posts.ID
AND wp_postmeta1.meta_key = '_sku'
LEFT JOIN wp_postmeta wp_postmeta2
import requests
from bs4 import BeautifulSoup
import time
USER_AGENT = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
def fetch_results(search_term, number_results, language_code):
assert isinstance(search_term, str), 'Search term must be a string'
assert isinstance(number_results, int), 'Number of results must be an integer'
@f0ster
f0ster / slack_history.py
Last active November 8, 2019 01:25
slack history downloader (pub and priv) with rate limit retry :)
#https://gist.github.com/Chandler/fb7a070f52883849de35 SEE HERE
# MIT License
# Copyright (c) 2016 Chandler Abraham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@jchandra74
jchandra74 / PowerShell Customization.md
Last active July 19, 2024 20:41
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@bahoo
bahoo / export-users-from-slack-channel.py
Created February 2, 2017 21:28
Export users (first name, last name, email address) from a given Slack channel
import requests
SLACK_API_TOKEN = "xoxo-asdfghjkl..." # get one from https://api.slack.com/docs/oauth-test-tokens
CHANNEL_NAME = "general"
channel_list = requests.get('https://slack.com/api/channels.list?token=%s' % SLACK_API_TOKEN).json()['channels']
channel = filter(lambda c: c['name'] == CHANNEL_NAME, channel_list)[0]
channel_info = requests.get('https://slack.com/api/channels.info?token=%s&channel=%s' % (SLACK_API_TOKEN, channel['id'])).json()['channel']
members = channel_info['members']
@jgdoncel
jgdoncel / fn_remove_accents.sql
Last active April 19, 2024 12:20
MySQL Function to remove accents and special characters
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue COLLATE utf8_general_ci;;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';