Skip to content

Instantly share code, notes, and snippets.

View pjain's full-sized avatar

Pankaj Jain pjain

View GitHub Profile
@marijn
marijn / README.markdown
Last active October 1, 2023 13:42
List of countries in YAML, CSV and TXT format
@tomohiro
tomohiro / install-command-line-tools-for-xcode.sh
Created July 5, 2012 14:26
A shell script for installing some applications on OS X
#!/bin/sh
# This script will install Command Line Tools for Xcode on a fresh installation of OS X.
# Usage: curl https://raw.github.com/gist/3053979/install-command-line-tools-for-xcode.sh | sh
DMG='command_line_tools_for_xcode_june_2012.dmg'
cd $HOME/Downloads
if [ ! -f ./$DMG ]; then
echo 'Command Line Tools for Xcode not downloaded.'
@Moligaloo
Moligaloo / gist:3850710
Created October 8, 2012 04:22
Send mail with attachment and signature via AppleScript in OS X
tell application "Mail"
set theSubject to "Subject" -- the subject
set theContent to "Content" -- the content
set theAddress to "xxx@163.com" -- the receiver
set theSignatureName to "signature_name"-- the signature name
set theAttachmentFile to "Macintosh HD:Users:moligaloo:Downloads:attachment.pdf" -- the attachment path
set msg to make new outgoing message with properties {subject: theSubject, content: theContent, visible:true}
@homam
homam / apple-script-send-imessage.sh
Last active December 23, 2020 09:51
AppleScripts for sending iMessages and Attachment
osascript send-imessage.scpt "hello" "Homam Hosseini"
osascript send-imessage-pic.scpt `realpath northamerica-neb.jpg` "Homam Hosseini"
@bradp
bradp / setup.sh
Last active June 17, 2024 10:09
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@JesseRWeigel
JesseRWeigel / commands.txt
Created April 28, 2017 19:22
ImageMagick Compression Commands
// Must install ImageMagick first
http://www.imagemagick.org/script/index.php
//This compresses a jpg with no visible loss of quality. Add in your own file names for target.jpg and result.jpg
convert -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% target.jpg result.jpg
// This does the same as above but to an entire folder (will overwrite original files):
mogrify -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% *.jpg
//This does the same thing but to all subfolders as well (Be careful with this one it will overwrite all original files)
@cmikeb1
cmikeb1 / fetchCoinPrice.scpt
Created June 9, 2017 01:12
AppleScript to retrieve crypto currency prices
validate_sheet()
set coins to {}
-- retrieve the list of coins from number
tell application "Numbers"
tell table 1 of sheet 1 of document 1
set cntRow to count row
set cntCol to count column
@pjain
pjain / hello_crypto_world.py
Last active September 29, 2019 05:04
Hello World for [Crypto] Quant Traders
#!/usr/local/bin/python
# based on the script by MR Jain at https://gist.github.com/mrjain/891cc88809697fb6a9c8872942fa8873#file-hello_world-py
import sys, getopt
# Add the pandas library
import pandas as pd
import pandas_datareader.data as web
import psycopg2 as pg
import pandas.io.sql as psql
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@dive
dive / fix-emacs-permissions-catalina.el
Created September 29, 2019 09:55
Fix Emacs permissions on macOS Catalina
;;; package --- Fix permissions for Emacs.app on macOS Catalina
;;; Author: Artem Loenko
;;; Mail-To: <artyom.loenko@mac.com>
;;; Commentary:
;;; Code:
(defconst _default-emacs-app-plist-path "/Applications/Emacs.app/Contents/Info.plist")
(defconst _temp-buffer-name "*fixing Emacs permissions*")
(defconst _temp-buffer (get-buffer-create _temp-buffer-name))
(with-current-buffer _temp-buffer (erase-buffer))