Skip to content

Instantly share code, notes, and snippets.

View koffisani's full-sized avatar

Koffi SANI koffisani

View GitHub Profile
@faniska
faniska / wkhtmltopdf.sh
Last active March 11, 2024 11:51
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@koffisani
koffisani / drop-constraint-and-create-again-sql-server.sql
Created December 28, 2016 09:23
Drop and Create constraints in SQL Server
CREATE TABLE #x -- feel free to use a permanent table
(
drop_script NVARCHAR(MAX),
create_script NVARCHAR(MAX)
);
DECLARE @drop NVARCHAR(MAX) = N'',
@create NVARCHAR(MAX) = N'';
-- drop is easy, just build a simple concatenated list from sys.foreign_keys:
SELECT @drop += N'
ALTER TABLE ' + QUOTENAME(cs.name) + '.' + QUOTENAME(ct.name)
@koffisani
koffisani / sending-mail-in-PHP-with-mail-function.php
Created December 27, 2016 22:16
Sending mail in PHP with native mail function
<?php if(isset($_POST['submit'])){
if(isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['subject']) && !empty($_POST['subject']) && isset($_POST['message']) && !empty($_POST['message'])){
$to = "contact@micronium.net";
$subject = $_POST['subject'];
$message = $_POST['message'];
//$header = "Name= " .
$header = "From:" . $_POST['name'] . " <" . $_POST['email'] . "> \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$header .= "X-Mailer: PHP/" . phpversion();
@mpaepper
mpaepper / android-ubuntu
Last active December 20, 2023 18:26
How to debug your Android device under Ubuntu
When programming apps for Android, you usually want to test them on real Android devices.
This little gist describes how to do so using Ubuntu 14.
First, you need to download and install the Android development IDE (http://developer.android.com/sdk/index.html) and create an Android project which you want to debug.
Next, you need to setup the debugging mode on your Android device. Starting in Android 4.2 you need to enable the developer options first: 1) Go to settings 2) Go to About Phone 3) Tap the build number 10 times (or more, not sure ;)) and you will get the notification that you enabled it.
Then go to the developer settings and enable the debug mode for your phone.
Now you think you can just plug it into your USB mode? - Nope.
@Grafikart
Grafikart / gist:a753044d9bfaf622b257
Created April 22, 2015 13:21
Envoy.blade.php pour CakePHP
@servers(['web' => 'tuto@localhost'])
@setup
$dir = "/home/tuto";
$dirlinks = ['tmp/cache/models', 'tmp/cache/persistent', 'tmp/cache/views', 'tmp/sessions', 'tests', 'logs'];
$filelinks = ['config/app.php'];
$releases = 3;
$remote = false;
$shared = $dir . '/shared';
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@chuckreynolds
chuckreynolds / wordpress-change-domain-migration.sql
Last active February 10, 2023 18:56
UPDATE: Use WP-CLI find-replace command to edit URLs in your database. https://developer.wordpress.org/cli/commands/search-replace/ Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: al…
/* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */