Skip to content

Instantly share code, notes, and snippets.

View kevinkarwaski's full-sized avatar

Kevin Karwaski kevinkarwaski

View GitHub Profile
@ChrisRut
ChrisRut / gist:1564bd2e2b28ec05c7066d38171f0c59
Last active September 24, 2018 19:04
Number of beers kevin owes me
Number of beers Kevin owes me: 2
@arkadiyt
arkadiyt / main.py
Last active January 18, 2024 00:12
import boto3
import certbot.main
import datetime
import os
import raven
import subprocess
def read_and_delete_file(path):
with open(path, 'r') as file:
contents = file.read()
@haskaalo
haskaalo / tarcheatsheet.md
Last active April 8, 2024 14:19
Tar usage / Tar Cheat Sheet

Tar Usage / Cheat Sheet

Compress a file or directory

e.g: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: makes tar talk a lot. Verbose output shows you all the files being archived and much.
  • -f: Allows you to specify the filename of the archive.
@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
@olalonde
olalonde / boot2docker-use-nfs.sh
Last active December 4, 2023 12:07
Script to mount /Users with nfs instead of vboxsf in boot2docker
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#
@Oneiroi
Oneiroi / Check server
Created March 4, 2015 16:37
SSL FREAK tests
openssl s_client -cipher EXPORT -connect domain.com:443 < /dev/null 2>/dev/null | grep SSL-Session | wc -l
@quellish
quellish / xcci.md
Created October 28, 2014 03:03
Xcode CI script variables

Variable

Type

@mmcc
mmcc / b2dntp
Created September 11, 2014 16:49
boot2docker NTP update
#!/bin/sh
# Fix NTP/Time
# https://github.com/boot2docker/boot2docker/issues/290
boot2docker ssh -- sudo killall -9 ntpd
boot2docker ssh -- sudo ntpclient -s -h pool.ntp.org
boot2docker ssh -- sudo ntpd -p pool.ntp.org
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 10, 2024 14:39
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Running command {:args=>["/bin/bash", "-c", "env PYTHONPATH=/usr/lib/ruby/gems/1.9.1/gems/fpm-1.0.1/lib/fpm/package python setup.py --command-packages=pyfpm get_metadata --output=/tmp/package-python-build20131211-11854-1r8ym9h/metadata.json"], :level=>:debug, :file=>"fpm/util.rb", :line=>"48"}
Process is running {:pid=>11859, :level=>:debug, :file=>"fpm/util.rb", :line=>"61"}
Running from scipy source directory. {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
or: setup.py --help [cmd1 cmd2 ...] {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
or: setup.py --help-commands {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
or: setup.py cmd --help {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
{:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
error: invalid command 'get_metadata' {:level=>:info, :file=>"cabin/mixins/pipe