Skip to content

Instantly share code, notes, and snippets.

eegrok / gist:9ccfcf060aab1e065651d0e2f70fd46c
Created February 23, 2023 21:39
Example of how to tell when a TabView changes which tab is selected, or when the same tab is tapped when it is already selected.
View gist:9ccfcf060aab1e065651d0e2f70fd46c
// ContentView.swift
// TestTabs
// Created by Kem Mason on 24/02/23.
import SwiftUI
enum TopNavTag: Hashable {
eegrok / gist:79d29a705e0c600460f0c4a1c2170835
Last active September 13, 2020 23:22
one liners for tcp socket connection test in ruby
View gist:79d29a705e0c600460f0c4a1c2170835
# client
ip_addr = 'server_addr'; require 'socket'; loop { begin; sock =, 2000); while (str = sock.readline) do puts str; end; rescue EOFError; sleep 1; next; rescue Errno::ECONNREFUSED; puts "FAIL"; end; sleep 1; }
# server
require 'socket'; server = 2000; loop { Thread.start(server.accept) do |client| client.puts "Hello !"; client.puts "Time is #{}"; client.close; puts "Handled request at #{}"; end; }
eegrok / mysql-import-individual-table
Created November 22, 2014 05:23
extract individual tables from database dump, for import -- mysql
View mysql-import-individual-table
touch /tmp/empty
ack "Table structure" /path/to/database_backup.sql /tmp/empty
it spits out something like this:
56160:-- Table structure for table `sub_human`
56195:-- Table structure for table `fool`
56385:-- Table structure for table `fool_games`
56465:-- Table structure for table `fool_games_old`
56657:-- Table structure for table `fool_games_texts`
eegrok /
Last active August 29, 2015 14:05 — forked from jellybeansoup/
install command line tools on osx / other libraries as well
# Install autoconf, automake, libtool and pkg-config smoothly on Mac OS X.
# Newer versions of these libraries may be available and may work better on OS X
# This script is originally from
export build=~/src # or wherever you'd like to build
eegrok / curl-ca-cert-import.txt
Created April 16, 2014 01:04
View curl-ca-cert-import.txt
# I recently got the following error while using curl:
# curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
# error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
openssl s_client -connect |tee logfile
# then QUIT <RETURN>
# copy from BEGIN CERTIFICATE to END CERTIFICATE into /tmp/certstuff.pem
openssl x509 -inform PEM -in /tmp/certstuff.pem -text -out certdata
cat certdata
# in there, I saw this line:
eegrok / locate.updatedb.comment
Created April 8, 2014 23:40
locate.updatedb on osx as root instead of nobody user -- indexes home directory files
View locate.updatedb.comment
# comment out this region to index as root according to:
# if [ "$(id -u)" = "0" ]; then
# rc=0
# export FCODES=`mktemp -t updatedb`
# chown nobody $FCODES
# tmpdb=`su -fm nobody -c "$0"` || rc=1
# if [ $rc = 0 ]; then
# install -m 0444 -o nobody -g wheel $FCODES /var/db/locate.database
# fi
View ubuntu-install.txt
#instructions for ubuntu 12.04
sudo apt-get -y update
sudo apt-get install git emacs curl build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev libmysql-ruby libmysqlclient-dev
cd /tmp
#install ruby -- from:
tar -xvzf ruby-2.0.0-p353.tar.gz
cd ruby-2.0.0-p353/
./configure --prefix=/usr/local
View gist:8851553

general settings

  • turn off key clicks: Progrm + backslash

remap - any platform (press they key you want it to be first, then the key you will press to get that)

  • Tab --> Caps Lock
  • Esc --> Tab
  • Back Space --> Ctrl (left)
  • Delete --> Alt (left)
  • Down Arrow --> ]}
  • [{ --> Down Arrow
eegrok /
Created February 28, 2013 22:52
save patch / apply it using git
#this will save off a single commits patch, so you can apply it
# if you leave off from --stdout to the right, it'll create a patchfile in the current directory with a name
# that includes the comment from the commit
git format-patch -1 095e61f --stdout > /tmp/patchname.patch
# this will check the patch to see if any conflicts will arise when applying it
git apply --check /tmp/patchname.patch
# this will apply the patch
git apply /tmp/patchname.patch
eegrok / toggle-mic-mute.applescript
Last active December 13, 2015 21:49
applescript to toggle mute / notify via growl
View toggle-mic-mute.applescript
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Microphone Muted", "Mic Live"}