Skip to content

Instantly share code, notes, and snippets.

@gimbo
gimbo / restart_xbar.sh
Created June 3, 2021 16:28
A bash script to kill/restart xbar, in response to xbar issue #714
#!/usr/bin/env bash
# See https://github.com/matryer/xbar/issues/714
getxbarpid () {
ps -Ac -o pid=,comm= | grep xbar | column -t | cut -d ' ' -f 1
}
xbarpid="$(getxbarpid)"
if [ -z "$xbarpid" ] ; then
@ajinux
ajinux / README.md
Last active September 27, 2023 21:39
This python script scrapes the fedex website and outputs the package details on giving the package tracking id as input

FEDEX SCRAPER

Question

Question Code:FEDEX
                    Write a Python script which will scrape the FEDEX website to obtain the tracking details of the given shipment tracking details. The output by the script should be in JSON format.
Input: 744668909687
Expected Output:
{ "tracking no": 744668909687,
"ship date": "Wed 19/07/2017",
"status": "delivered",
"scheduled delivery": "Mon 24/07/2017 16:21"

@aubricus
aubricus / License
Last active June 20, 2023 01:19
Python Progress Bar
Copyright 2020 Aubrey Taylor
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 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH
@voxxit
voxxit / download-slow-query-log.sh
Last active October 31, 2023 16:13
Downloads RDS slow query logs for the last 24 hours using the AWS CLI
#!/bin/bash
instanceID=$1
date=$(date +%Y%m%d)
function downloadLog () {
local log=$1
aws rds download-db-log-file-portion \
--output text \
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active April 20, 2024 02:26
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@bittner
bittner / django-csrftoken-login-demo.bash
Last active August 15, 2022 23:45
Login and perform actions in a Django site (now with less security issues)
# source this code in a Bash shell ($ . django-csrftoken-login-demo.bash),
# and run with a DB name as parameter (e.g. $ django-csrftoken-login-demo demo)
django-csrftoken-login-demo() {
# -- CHANGE THESE VALUES TO MATCH YOUR ACCOUNT --
local HOSTING_USERID=9988
local HOSTING_PANEL_USER='customer@email.address'
local HOSTING_PANEL_PASS='my secret login password'
local HOSTING_DB_PREFIX='username_'
local DB_NAME=$HOSTING_DB_PREFIX$1
@drakeguan
drakeguan / ConvertEXRToJPG.py
Created August 22, 2013 03:55
Convert OpenEXR to JPEG with gamma encoding (2.4) efficiently through OpenEXR and numpy.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy
import OpenEXR
import Imath
import Image