Skip to content

Instantly share code, notes, and snippets.

View Sanix-Darker's full-sized avatar
🐼
coding in the dark...

darker Sanix-Darker

🐼
coding in the dark...
View GitHub Profile
@Kartones
Kartones / postgres-cheatsheet.md
Last active June 30, 2024 07:52
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
#!/bin/bash
################################################################################
### OpenCV2 Installation Script ###
################################################################################
# Source code at https://github.com/arthurbeggs/scripts #
################################################################################
# #
# Feel free to copy and modify this file. Giving me credit for it is your #
# choice, but please keep references to other people's work, which I don't #
@sloanlance
sloanlance / Editing remote files in Vim with SSH.md
Created July 13, 2017 16:11
Editing remote files in Vim with SSH

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p
    
@Sanix-Darker
Sanix-Darker / [HTML - JS - PHP] Multiple ReCaptcha on the same page
Last active March 28, 2018 10:08
[HTML - JS - PHP] Google normaly don't permit to do a multiple Recaptcha on the same page, so there is a way to solve this issue!
<?php
// Configure your keys (secret, piblic): https://www.google.com/recaptcha
$siteKey = 'XXXXXXXXXXXXXXXXXXXXXX'; // votre clé publique
?>
<form action="submit.php">
....
<div class="g-recaptcha" id="Optional-id"></div>
</form>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<script type="text/javascript" charset="utf-8">
@Sanix-Darker
Sanix-Darker / [JS] Using the core $.ajax() method
Last active September 23, 2017 20:49
[JS] Using the core $.ajax() method
// Using the core $.ajax() method
$.ajax({
// The URL for the request
url: "post.php",
// The data to send (will be converted to a query string)
data: {
id: 123
},
// Whether this is a POST or GET request
type: "GET",
@Geoyi
Geoyi / install virtualenv ubuntu 16.04.md
Created September 16, 2017 12:19 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@Sanix-Darker
Sanix-Darker / [Shell] Install Java JDK 1.8 on Debian, Kali linux
Last active January 21, 2024 01:18
[Shell] Install Java JDK 1.8 on Debian, Kali linux
sudo su -
cat >/etc/apt/sources.list.d/webupd8team-java.list<< EOF
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
EOF
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
java -version
@Sanix-Darker
Sanix-Darker / SUBLIME TEXT 2.X, 3.X UNIVERSAL LICENSE CRACK KEYS COLLECTION FOR WIN, MAC & LINUX WORKING
Created September 17, 2017 20:07
SUBLIME TEXT 2.X, 3.X UNIVERSAL LICENSE CRACK KEYS COLLECTION FOR WIN, MAC & LINuX WORKING
// Sublime Text 3 License Keys //
Sublime Text 2.x (for all Builds)
—– BEGIN LICENSE —–
Andrew Weber
Single User License
EA7E-855605
813A03DD 5E4AD9E6 6C0EEB94 BC99798F
942194A6 02396E98 E62C9979 4BB979FE
91424C9D A45400BF F6747D88 2FB88078
@Sanix-Darker
Sanix-Darker / [PHP] Simples amazing PHP fonctions
Last active April 12, 2018 03:05
[PHP] Simples amazing PHP fonctions
function InsertOrNot($BD){ // Permet de savoir si oui ou non, un truc a ete inserer dans la base de donnees ou pas!
$stmt = $BD->query("SELECT LAST_INSERT_ID()");
$lastId = $stmt->fetch(PDO::FETCH_NUM);
$lastId = $lastId[0];
if($lastId>0){
echo "<center><i class=\"green\"><i class=\"fa fa-check\"></i> Op&eacute;ration &eacute;ffectu&eacute;e<i></center>";
}else{
echo "<center><i class=\"red\"><i class=\"fa fa-times\"></i>Erreur d&eacute;tect&eacute;e<i></center>";
}
@Sanix-Darker
Sanix-Darker / [PHP] Force a download of a file
Last active September 23, 2017 20:47
[PHP] Force a download of a file
<?php
if(isset($_REQUEST['src'])){
$file_name = $_REQUEST['src'];
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".$file_name."\"");
readfile('../Your_Path_Here/'.$file_name);
exit;
}
?>