Skip to content

Instantly share code, notes, and snippets.

@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@SVilgelm
SVilgelm / send_email.py
Last active April 21, 2020 00:21
send email
#!/usr/bin/env python2
from email import header
from email.mime import audio
from email.mime import application
from email.mime import image
from email.mime import multipart
from email.mime import text
import logging
import mimetypes
@patik
patik / how-to-squash-commits-in-git.md
Last active May 30, 2024 07:59
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@claymcleod
claymcleod / pycurses.py
Last active July 20, 2024 00:12
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@biomiker
biomiker / gridFloatElevation.pl
Created May 10, 2017 23:42
Perl script for downloading and extracting USGS elevation data
#!/usr/bin/env perl
use strict;
use POSIX;
use Math::Round;
my $debug = 0;
my $dataDir = "/Users/miker/elevation/data";
my $usgsUrl = "https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/GridFloat";
@Mister-Meeseeks
Mister-Meeseeks / aptRecurse.sh
Last active June 27, 2022 12:05
Download apt-get packages and recursive dependencies
#!/bin/bash -eu
# Uses apt-get to download packages and all recursive dependencies to an apt
# repository compatible directory.
#
# Usage:
# aptRecurse [-o OUT_DIRECTORY] PACKAGE_NAME [PACKAGE_NAME]...
#
# (Credit to this StackOverflow comment
# https://stackoverflow.com/a/45489718/868777)
@sarimarton
sarimarton / fix_github_copilot.sh
Last active April 24, 2024 06:59
Fix Github Copilot in dealing with self-signed certificates
# [2023-05-25] Added Copilot Chat, and VSCode Insiders
# [2023-05-20] Add VSCode Insiders variant
# [2023-02-22] Added Copilot Labs
# Fix Github Co-pilot self-signed cert problem
# See: https://github.com/orgs/community/discussions/8866#discussioncomment-3517831
# Note
#
# To make Github Copilot/Nightly/Labs/Chat work, you might need additional