Skip to content

Instantly share code, notes, and snippets.

View UmutAlihan's full-sized avatar

Alihan UmutAlihan

  • Istanbul, Turkey
View GitHub Profile
@mitrnsplt
mitrnsplt / credit card check
Created April 17, 2014 00:48
A solution for cs50's credit card validation problem
/**
*
* credit.c
*
* Peter Downs
*
* A program for validating credit card numbers.
*
*/
@davfre
davfre / git_cheat-sheet.md
Last active February 12, 2025 06:24
git commandline cheat-sheet
@mrkline
mrkline / c_sharp_for_python.md
Last active September 2, 2024 15:51
An intro to C# for a Python developer. Made for one of my coworkers.

C# For Python Programmers

Syntax and core concepts

Basic Syntax

  • Single-line comments are started with //. Multi-line comments are started with /* and ended with */.

  • C# uses braces ({ and }) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,

@hofmannsven
hofmannsven / README.md
Last active April 1, 2025 06:51
Git CLI Cheatsheet
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active March 27, 2025 04:09
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

@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
@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 + ' '
@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.
@jednano
jednano / gitcom.md
Last active February 27, 2025 03:05
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
@ff6347
ff6347 / clone_remote_branch.md
Last active April 13, 2023 19:34
clone remote branch with git