Skip to content

Instantly share code, notes, and snippets.

View IsmailM's full-sized avatar
👋
Focusing

Ismail Moghul IsmailM

👋
Focusing
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 17, 2024 01:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mef
mef / pre-render.js
Last active May 20, 2022 16:56
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
// pre-render d3 charts at server side
var d3 = require('d3')
, jsdom = require('jsdom')
, fs = require('fs')
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>'
jsdom.env({
features : { QuerySelector : true }
, html : htmlStub
, done : function(errors, window) {
@slowkow
slowkow / mycd.sh
Last active September 8, 2015 15:55 — forked from leipzig/mycd.sh
Record folder-specific history in `.dir_bash_history`
function cd_dir_history()
{
OLDPWD="$PWD"
echo "# $(date) $USER -> $@" >> "$HISTFILE"
command cd "$@"
# If this directory is writable then write to directory-based history file
# otherwise write history in the usual home-based history file.
touch "$PWD/.dir_bash_history" 2>/dev/null \
@IsmailM
IsmailM / Agnoster
Last active October 14, 2015 07:21
Custom Agnoster theme - with fish-like collapsed directories and without the unnecessary WHOAMI part and
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@olivierpierre
olivierpierre / pigzc.sh
Created July 13, 2016 19:01
Compress a directory tree into a tarball using pigz
#!/bin/sh
if [ "$1" == "" ]; then
echo "Usage: $0 <folder to compress>"
exit
fi
NAME=`basename $1`
tar -c --use-compress-program=pigz -f $NAME.tar.gz $NAME
@olivierpierre
olivierpierre / pigzu.sh
Created July 13, 2016 19:02
Uncompress a directory tree contained in a tarball with pigz
#!/bin/sh
if [ "$1" == "" ]; then
echo "Usage: $0 <file to uncompress>"
exit
fi
pigz -dc $1 | tar xf -
@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active November 7, 2024 12:31
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.