Skip to content

Instantly share code, notes, and snippets.

View UmutAlihan's full-sized avatar

Alihan UmutAlihan

  • Istanbul, Turkey
View GitHub Profile
@justintv
justintv / .bashrc
Created August 17, 2009 00:53
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"
@jayrambhia
jayrambhia / bookmark-html.py
Created January 27, 2012 19:11
Extract bookmarks (from html file) from the browser
"""
@author: jay
"""
from BeautifulSoup import BeautifulSoup
import gdbm
import pickle
import time
def main():
@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@ff6347
ff6347 / clone_remote_branch.md
Last active April 13, 2023 19:34
clone remote branch with git
@jednano
jednano / gitcom.md
Last active May 31, 2023 08:23
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

git init
@BDollar
BDollar / Powershell WMI Inventory A
Created April 24, 2013 20:01
MS Powershell - Using WMI to create a computer inventory
# ==============================================================================================
#
# Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2007
#
# NAME: Server/Workstation Inventory (CompInv_v2.ps1)
#
# AUTHOR: Jesse Hamrick
# DATE : 2/25/2009
# Web : www.PowerShellPro.com
# COMMENT: Script Inventories Computers and sends results to an excel file.
@destan
destan / text2png.py
Last active January 10, 2024 06:32
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '
@anastasop
anastasop / beq.py
Created June 16, 2013 16:17
A simple python script that unifies bookmark files exported from chrome and firefox. Useful for old backups but pretty useless in the cloud age. It uses BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/) for html parsing and jinja2 (http://jinja.pocoo.org/docs/) for templating. Tested with python 2.7.3 on ubuntu 64bit 12.04 LTS. The c…
#!/usr/bin/python
# create the union of a set of mozilla bookmarks files
# usage: ./beq.py bookmarks-20110501.html bookmarks-20120101.html > bookmarks.html
#
# license: the code is in the public domain
from bs4 import BeautifulSoup
from jinja2 import Template
import sys
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active July 18, 2024 07:57
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@hofmannsven
hofmannsven / README.md
Last active July 16, 2024 01:30
Git CLI Cheatsheet