Skip to content

Instantly share code, notes, and snippets.

View tahaghafuri's full-sized avatar
👨‍💻
Coding

Taha Amin Ghafuri [T@G] tahaghafuri

👨‍💻
Coding
View GitHub Profile
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active April 27, 2025 09:56
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@jamielaundon
jamielaundon / create-pfx
Created January 22, 2016 22:02
Create IIS .pfx from Let's Encrypt fullchain and privkey
sudo openssl pkcs12 -export -in /etc/letsencrypt/live/domain.com/fullchain.pem -inkey /etc/letsencrypt/live/domain.com/privkey.pem -out domain.com.pfx
@amcsi
amcsi / str_replace.c
Created May 19, 2015 10:03
My str_replace() implementation in C
/**
* @author amcsi / Szerémi Attila
**/
#include <stdio.h>
/**
* Returns the length of a string
**/
int strlen(char* str) {
@bcremer
bcremer / build-minimal-php.sh
Last active May 11, 2023 14:39
Compile Minimal Version of PHP used for Lint-Check legacy code
mkdir source
cd source
wget http://museum.php.net/php5/php-5.2.17.tar.gz
tar xvf php-5.2.17.tar.gz
cd php-5.2.17
./configure --disable-all --enable-static --enable-cli
make
cp sapi/cli/php ~/bin/php5.2.17-x64-static
@Toddses
Toddses / iis-web.config
Last active May 25, 2024 10:16
Example web.config for WordPress on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
@ircmaxell
ircmaxell / php_zpp.php
Last active March 1, 2023 23:48
Zend Parse Parameters. In PHP
<?php
namespace ZPP;
const IS_STRING = "string";
const IS_BOOL = "boolean";
const IS_LONG = "integer";
const IS_DOUBLE = "double";
const IS_ARRAY = "array";
const IS_OBJECT = "object";
@adhocore
adhocore / Obfuscator.php
Created December 31, 2013 16:06
Obfuscator - The naive and trivial PHP Code obfuscator | deobfuscator
<?php
/**
* Obfuscator - The naive and trivial PHP Code obfuscator | deobfuscator
*
* generate() Generates a obfuscated string of given code
* also gives the chunk value required by work()
* work() Reverses the obfuscated string using chunk value given by generate()
* to original code and then execute the code and returns response
*
@ck-on
ck-on / ocp.php
Last active March 14, 2025 08:34
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@GerHobbelt
GerHobbelt / .gitignore
Created May 6, 2012 15:59
svg -> foreign object -> iframe to load and render arbitrary html inside SVG (based on Matt Finkle article)
# Editor backup files
*.bak
*~