Skip to content

Instantly share code, notes, and snippets.

@realfirst
realfirst / tmux-cheatsheet.markdown
Created April 24, 2024 12:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/bin/bash
# Source https://stackoverflow.com/questions/36651091/how-to-install-packages-in-linux-centos-without-root-user-with-automatic-depen
pkgname=$1
if [ -z $pkgname ]; then
echo "Usage: ./non-root-yum-install.sh pkgname-here"
exit 1
fi
rand=$(openssl rand -base64 6)
@realfirst
realfirst / a-clash-tproxy-gateway.md
Created November 20, 2023 14:19 — forked from phlinhng/a-clash-tproxy-gateway.md
Clash as transparent proxy gateway via TPROXY

Notes

  1. If your local network use public IP ranges instead of private ones, make sure to add respecive RETURN rules to iptables to prevent looping issue
  2. Set clash as DHCP's only DNS server to allow domain-based filter (shunting) rules work
  3. Use lsof -i udp:53 to check if clash's DNS module work fine, otherwise you may have to kill systemd-resolved and any other processes occupying the UDP 53 port
  4. The given scripts will NOT hangle the traffic of gateway itself since it is not recommend to do so. If you want to redirect the egress traffic of the gateway, the following material may be useful

Reference

@realfirst
realfirst / define.py
Created August 3, 2022 02:57 — forked from lambdamusic/define.py
Access osx dictionary in python
#!/usr/bin/env python
"""
# Version
2021-08-31
# Tested on
Python 3.9
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_wn-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-moby-thesaurus-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-web1913-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_elements-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-vera-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-easton-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_hitchcock-2.4.2.tar.bz2
@realfirst
realfirst / GIF-Screencast-OSX.md
Created April 22, 2019 10:36 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@realfirst
realfirst / installing-presto-cli.md
Created August 1, 2018 01:27 — forked from simonw/installing-presto-cli.md
Installing the Presto command-line tool

Installing the Presto command-line tool

I had to install Java to get presto working

brew cask install java

From https://prestodb.io/docs/current/installation/cli.html I did:

wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.202/presto-cli-0.202-executable.jar

mv presto-cli-0.202-executable.jar presto

@realfirst
realfirst / README.md
Created July 9, 2018 07:56 — forked from Yengas/README.md
Finding common friends of a given steam users, and creating a graph network.

Steam Friends

This is a simple ruby script to create (in adjacent list format) graph networks of a given array of steam users. You can also use this script to find the most common friends of a given group of users.

Examples

Below are some examples of using this script.

Creating a graph network

outputCSV(createNetwork(['yigitcan2', 'Boneslark']), 'output.csv');
@realfirst
realfirst / CDHTez.md
Created June 29, 2018 07:08 — forked from epiphani/CDHTez.md
Getting Tez enabled on CDH5.4+

So Hive in CDH is horribly, painfully slow. Cloudera ships Hive 1.1, which is actually moderately modern. It is, however, very badly configured out of the box and patched with custom code from Cloudera. With a bit of effort, we managed to improve hive performance considerably. We really shouldn't have to do this, but Cloudera is actively working against supporting a performant Hive.

First, building Tez was fairly straightforward. Using the instructions at https://github.com/apache/tez/blob/master/docs/src/site/markdown/install.md, the only change was to use the version string "2.6.0" for the build. I believe that was the default. Don't use the CDH string, it won't work.

At the bottom of the installation instructions, there's mention of the fact that to use the local hadoop jars (rather than those packaged with tez) you must unpack the jars in HDFS rather than using the tarball. In this case, unpack the tez-minimal tarball and upload the contents to /apps/tez-0.7.0 (or whatever you prefer). Don't fo

@realfirst
realfirst / hack.sh
Created June 29, 2018 07:04 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#