Skip to content

Instantly share code, notes, and snippets.

View sergiitk's full-sized avatar
🚀
Back to work

Sergii Tkachenko sergiitk

🚀
Back to work
View GitHub Profile
@sergiitk
sergiitk / shell-tools.md
Last active April 4, 2018 20:45
Useful shell tools

Useful shell tools (BSD)

Strings

  • l | tail +2 — Skip first line of stdout
  • l | head -n-1 — Skip last line of stdout (GNU version only)
  • echo "test" | head -c-1 — Remove last newline
  • comm -12 <(echo 1; echo 2) <(echo 1; echo 2; echo 3) — Shows intersection (here 1 2).
  • cat template.txt | envsubst — substitutes environment variables in file
  • echo 123abc | od -c -t d1 — Show decimal dump
  • echo 123abc | xxd — Show a hexdump (or do the reverse)
@sergiitk
sergiitk / Railscast2.tmTheme
Created September 1, 2013 16:21 — forked from smlombardi/Railscast2.tmTheme
Railscast theme for Sublime Text 2. Markdown syntax highlighting added.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Railscasts 2</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@sergiitk
sergiitk / osx-terminal.md
Last active March 8, 2024 10:32
OSX terminal tips an tricks

OS X terminal tips an tricks

Shell tools

System

  • sw_vers — Print Mac OS X operating system version information
  • system_profiler — Reports system hardware and software configuration.
  • system_profiler SPHardwareDataType — Hardware overview.
  • hostinfo — Host information.
  • nvram -p — Print all of the firmware variables.
  • getconf DARWIN_USER_CACHE_DIR — Retrieve standard configuration variables
  • /usr/libexec/path_helper — Helper for constructing PATH environment variable
@sergiitk
sergiitk / gistbox_userscript_copycode.js
Created September 26, 2013 15:20
GistBox copy code on double click
// ==UserScript==
// @name GitBox extra features
// @namespace https://www.facebook.com/sergii.tk
// @version 0.1
// @description Copies code blocks to clipboard
// @match https://app.gistboxapp.com/*
// @copyright 2013+, Sergii Tkachenko
// @require https://raw.github.com/rafjaf/ClipCopy-for-TM/master/lib/installGM_setClipboard.js
// ==/UserScript==
@sergiitk
sergiitk / gistbox_userscript_copycode_links.js
Created September 26, 2013 15:34
GistBox copy code on double click: copy link address over following it
@sergiitk
sergiitk / drupal.md
Created December 25, 2013 10:11
Drupal Cookbook

Drupal Cookbook

Upgrade

  • Remove all files from working directory — _ rm -rf ^.git(D)
  • Open Drupal Releases page
  • Copy link to the last release compressed to tar.gz
  • Download and extract last Drupal — tar xvf =(curl $(pbpaste)) --strip 1
  • Restore deleted files in sites and profiles folder — g ls-files -z --deleted -- {sites,profiles} | xargs -0 git checkout --
  • Show status for these folders — gst -- {sites,profiles}
  • In most cases all changes to profiles folder are necessary — ga profiles/
  • It's ok to update default.settings.php — ga sites/default/default.settings.php
name = VoxPelli OAuth Test
core = 7.x
dependencies[] = oauth_common
dependencies[] = http_client
@sergiitk
sergiitk / sergii.zsh-theme
Created January 22, 2015 17:07
Sergii's Zsh Theme
#!/usr/bin/env zsh
# ------------------------------------------------------------------------------
# Prompt for the Zsh shell:
# * One line.
# * VCS info on the right prompt.
# * Only shows the path on the left prompt by default.
# * Crops the path to a defined length and only shows the path relative to
# the current VCS repository root.
# * Wears a different color wether the last command succeeded/failed.
# * Shows user@hostname if connected through SSH.
@sergiitk
sergiitk / archer-ascii-telnet-server.txt
Created May 2, 2016 22:43
Archer / ASCII telnet server
This file has been truncated, but you can view the full file.
Trying 142.4.4.224...
Connected to figgis.agency.
Escape character is '^]'.

ALGERSOFT FILM
presents
@sergiitk
sergiitk / gist:2e2f7df8c0477df3a623cc1457d2b344
Created June 8, 2016 00:12 — forked from rmondello/gist:b933231b1fcc83a7db0b
Exporting (iCloud) Keychain and Safari credentials to a CSV file

Exporting (iCloud) Keychain and Safari credentials to a CSV file

After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.

This is the process I used to create a CSV file of his credentials in the format “example.com,user,pass”. This portable format would be pretty easy to import into 1Password or Safari in the future.

The way I went about this isn’t great; it opens up more opportunities for apps to control one’s Mac through Accessibility APIs, it writes plaintext passwords to disk, and it could use some cleaning up. A better approach might leverage the security command line tool that ships with OS X. That said, I found this method to be a fun illustration of what’s possible us