Skip to content

Instantly share code, notes, and snippets.

View musashiXXX's full-sized avatar

Charles Hamilton musashiXXX

  • Dyer & Associates, P.C. / Community Closing Network
  • Kensington, Maryland
View GitHub Profile
@ageis
ageis / .bashrc 02-25-2020
Last active January 28, 2024 19:12
@ageis's ~/.bashrc 🖥️ with numerous useful functions, aliases and one-liners. ⚠️ NOTE: many paths in sourced scripts and environment variables are specific to my system, but if you dig in I hope you'll find something you can use!
#!/bin/bash
# ~/.bashrc: executed by bash(1) for non-login shells.
# kevin gallagher (@ageis) <kevingallagher@gmail.com>
# normally I divide this into separate files: .bashrc, .bash_profile, .bash_aliases and .bash_functions (also .bash_logout), but it's all concatenated here.
ulimit -s unlimited
export MYUID=$(id -u)
export USER="$(id -un)"
if [[ "$TILIX_ID" ]] || [[ "$VTE_VERSION" ]]; then
@gleicon
gleicon / list_objects_google_storage_boto3.py
Last active October 11, 2023 14:27
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@kriwil
kriwil / hello_pyodbc.py
Last active June 11, 2021 16:24 — forked from rduplain/README.md
ubuntu connect to mssql server using pyodbc
"Proof connection at pyodbc level."
# Test pyodbc connection. Result is 42.
# Note parameters in connection string, <PARAMETER>.
import pyodbc
conn = pyodbc.connect('DRIVER=FreeTDS;SERVER=<IP_OR_HOSTNAME>;PORT=1433;DATABASE=<DATABASE_NAME>;UID=<USERNAME>;PWD=<PASSWORD>;TDS_Version=8.0;')
cursor = conn.cursor()
for row in cursor.execute('select 6 * 7 as [Result];'):
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@goyuix
goyuix / Modify-DefaultHive.ps1
Created July 30, 2014 02:57
PowerShell to mount default NTUSER.DAT, modify it and unload it
Write-Host "Attempting to mount default registry hive"
& REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT
Push-Location 'HKLM:\DEFAULT\Software\Microsoft\Internet Explorer'
if (!(Test-Path Main)) {
Write-Warning "Adding missing default keys for IE"
New-Item Main
}
$sp = Get-ItemProperty -Path .\Main
Write-Host "Replacing $_ : $($sp.'Start Page')"
@evansims
evansims / example.html
Last active February 5, 2024 16:52
Embedding or sharing a image or photo uploaded to Google Drive.
<a href="https://drive.google.com/uc?export=view&id=XXX"><img src="https://drive.google.com/uc?export=view&id=XXX" style="width: 500px; max-width: 100%; height: auto" title="Click for the larger version." /></a>
@dsci
dsci / drop.sh
Created August 7, 2012 09:40
Dropping all tables in a PostgreSQL database
# first, login with psql
psql -U USERNAME -d databasename
# set output for all queries
\o FILENAME.sql
# run this query
select 'drop table ' || tablename || ' cascade;' from pg_tables;
# logout from psql
@cpliakas
cpliakas / ubuntu-x11
Created May 4, 2012 16:07
Headless X server on Ubuntu for X11 forwarding
#!/bin/bash
sudo apt-get install xserver-xorg xserver-xorg-core x11-apps x11-xserver-utils
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/