Skip to content

Instantly share code, notes, and snippets.

Avatar
🎃
Comiendo chaufita

KhalO KhanMaytok

🎃
Comiendo chaufita
View GitHub Profile
View gist:8211290
#############################################
# 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
View Operaciones-Git
#############################################
# 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
View smartgit.desktop
#!/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 Aug 29, 2015
Anonymous image upload to imgur
View upload-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 Aug 29, 2015
Create Swap after install
View create-swap
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 Apr 25, 2015
Restart mysql server if it is down
View mysql-monitor
#!/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.";
View mysql-backup
#!/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"
View gist:a393a0c006c77d1ee1b4
$(window).scroll(function(){
'use strict';
if ( $(window).scrollTop() > 49 ) {
$("#nav").addClass("nav-fixed");
} else {
$("#nav").removeClass("nav-fixed");
}
View index.html
<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">
View Doctrine anotattion generator
php bin/console doctrine:mapping:convert annotation ./src/AppBundle/Resources/config/doctrine/metadata/orm --from-database --force --filter="NombreDeTabla"