Skip to content

Instantly share code, notes, and snippets.

View mikekolganov's full-sized avatar

Mike Kolganov mikekolganov

View GitHub Profile
@scottopell
scottopell / fix_exfat_drive.md
Last active June 5, 2024 07:56
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@jbonney
jbonney / .bash_profile
Created February 4, 2014 13:43
Run ssh-agent when you login, and kill it when you logout. Add code to ~/.bash_profile. Taken from http://blog.xk72.com/post/75565726956/ssh-agent
eval `/usr/bin/ssh-agent -s`
trap "kill $SSH_AGENT_PID" 0
@tommysundstrom
tommysundstrom / sitemap.xml.builder
Last active January 1, 2022 23:21
Middleman xml sitemap (to aid Google and other search engines)
# encoding: utf-8
xml.instruct!
# Drop this file in your source directory
#
# Uses the builder gem.
# Add
# gem 'builder', '~> 2.0'
# to the Gemfile, and run builder install
#
@Roman2K
Roman2K / node.js
Created September 29, 2012 18:22
Ruby/node encryption/decryption
const crypto = require('crypto');
const PASSWORD = "098f6bcd4621d373cade4e832627b4f6"
, MESSAGE = 'test';
function InvalidSignatureError() {
Error.captureStackTrace(this, this.constructor);
}
function encipher(message, password, callback) {
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 29, 2024 08:12
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@asavartsov
asavartsov / Gemfile
Created February 17, 2012 16:49
Mongoid 3.0, Paperclip, embedded, accepts_nested_attributes_for and allow_destroy with optional description
gem 'rails', '3.2.1'
gem 'mongoid', :git => 'git://github.com/mongoid/mongoid.git'
gem 'mongoid-paperclip', :require => "mongoid_paperclip"
# if you're using rspec (should be temporary until mongoid-rspec will be updated to mongoid 3.0)
# group :test do
# gem "mongoid-rspec", :git => 'https://github.com/tanordheim/mongoid-rspec.git', :branch => 'mongoid_3_0'
# end
@BonsaiDen
BonsaiDen / tokenize.js
Created February 12, 2012 21:15
Small, simple, JS tokenizer in JS.
/**
* Simple JavaScript tokenizer (not a full parser!!!)
*
* Portions taken from Narcissus by Brendan Eich <brendan@mozilla.org>.
*/
/*jshint evil: true, regexdash: false, regexp: false */
var KEYWORDS = [
'break',