Skip to content

Instantly share code, notes, and snippets.

View msudgh's full-sized avatar

Masoud Ghorbani msudgh

View GitHub Profile
@arastu
arastu / current_track.applescript
Last active November 27, 2020 19:52
update twitter bio and add current playing song from Spotify to it
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"
@bermi
bermi / yaml-source.sh
Created March 9, 2020 18:35
Exposes key value pairs on a yaml file as environment variables
#!/usr/bin/env bash
# Exports a flat yaml key:value pairs as environment variables
#
# To source a yaml file as environment variables run
#
# . yaml-source env.yml
#
eval $(
cat $1 |
@rezkam
rezkam / remove_twitter_favorites.py
Created May 13, 2019 23:14
Remove likes (favorite) from your tweets using twitter API (Working with Python 3.5+)
"""
Remove likes (favorite) from your tweets using twitter API
you need to install twitter-client for python to use this code:
pip install python-twitter ( more info https://github.com/bear/python-twitter)
to use this you need to generate authntication tokens for your account
find more info on (https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens)
"""
import asyncio
@bradtraversy
bradtraversy / docker_wordpress.md
Last active July 11, 2024 00:07
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@Ryanb58
Ryanb58 / install.md
Last active June 25, 2024 19:59
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@ganapativs
ganapativs / iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup.md
Last active June 23, 2024 10:41
iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup
@numb95
numb95 / route-all-traffic-through-tor.md
Last active February 28, 2024 03:05
Route all internet traffic through Tor

Do not use in production Server or if you don't know what iptables do

Add this to torrc ( located on /etc/tor/torrc):

VirtualAddrNetwork 10.192.0.0/10

AutomapHostsOnResolve 1

TransPort 9051 
@narbehaj
narbehaj / find_duplicates.py
Last active May 28, 2018 23:54
Finds duplicate files under the directory
import hashlib
import os
m_list = []
for i, d , e in os.walk('/home/test/'):
for file in e:
if file.endswith('mkv'):
with open('{}/{}'.format(i, file), 'rb') as file_read:
for chunk in iter(lambda: file_read.read(4096), b""):
@william8th
william8th / .tmux.conf
Last active July 4, 2024 11:36
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# using:
# for set proxy:
# $ setproxy 127.0.0.1 8118
# for unset:
# $ unsetproxy
function setproxy() {
export {http,https,ftp,HTTP,HTTPS}_proxy=http://$1:$2
export no_proxy="localhost,127.0.0.1,master.cafecluster"
echo "Proxy variable(http,https,ftp) set to $1:$2"