Skip to content

Instantly share code, notes, and snippets.

View KhanMaytok's full-sized avatar
🎃
Comiendo chaufita

KhalO KhanMaytok

🎃
Comiendo chaufita
View GitHub Profile
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Name=Smartgit
Exec=env SMARTGIT_JAVA_HOME=/opt/apps/jre7/ /opt/apps/smartgit/bin/smartgit.sh
Icon=/opt/apps/smartgit/bin/smartgit-64.png
@KhanMaytok
KhanMaytok / upload-imgur
Last active August 29, 2015 14:18
Anonymous image upload to imgur
<html>
<h3>Form</h3>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
Image (< 50kb): <input type="file" name="upload" /><br/>
ClientID: <input type="text" name="clientid" /><br/>
<input type="submit" value="Upload to Imgur" />
</form>
</html>
<?php
@KhanMaytok
KhanMaytok / create-swap
Last active August 29, 2015 14:19
Create Swap after install
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
@KhanMaytok
KhanMaytok / mysql-monitor
Created April 25, 2015 00:26
Restart mysql server if it is down
#!/bin/bash
UP=$(service mysql status|grep 'mysql start/running' | wc -l);
if [ "$UP" -ne 1 ];
then
echo "MySQL is down.";
sudo service mysql start;
echo "MySQL has return";
else
echo "All is well.";
@KhanMaytok
KhanMaytok / mysql-backup
Created April 25, 2015 00:28
Backup Mysql
#!/bin/sh
now="$(date +'%d_%m_%Y_%H_%M_%S')"
filename="db_backup_$now".gz
backupfolder="/home/ubuntu/backups"
fullpathbackupfile="$backupfolder/$filename"
logfile="$backupfolder/"backup_log_"$(date +'%Y_%m')".txt
echo "mysqldump started at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
mysqldump --user=root --password=password --default-character-set=utf8 bd_vitekey_cloud | gzip > "$fullpathbackupfile"
echo "mysqldump finished at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
echo "file permission changed" >> "$logfile"
$(window).scroll(function(){
'use strict';
if ( $(window).scrollTop() > 49 ) {
$("#nav").addClass("nav-fixed");
} else {
$("#nav").removeClass("nav-fixed");
}
<h2>ASCII Animation Editor/Viewer</h2>
<table style="margin-left:auto;margin-right:auto">
<tr><td style="text-align:center">
Enter the frames below, separated by "<code>=====</code>".</td>
<td style="text-align:center">
<input type="button" value="Play the Animation" onclick="PlayAnimation();">
</tr>
<tr><td><textarea id="frameArea" rows=25 cols=55 style="font-size:8pt">
@KhanMaytok
KhanMaytok / Doctrine anotattion generator
Created May 30, 2015 16:02
Generar Entidades doctrine
php bin/console doctrine:mapping:convert annotation ./src/AppBundle/Resources/config/doctrine/metadata/orm --from-database --force --filter="NombreDeTabla"