Skip to content

Instantly share code, notes, and snippets.

View anabelle's full-sized avatar

Anabelle Handdoek anabelle

View GitHub Profile
@mixonic
mixonic / .gitignore
Created May 16, 2011 18:55
Mousy - A shared cursor for webpages using Node.js
node_modules
public/socket.io.min.js
public/jquery.js
@malthe
malthe / less.app
Created September 22, 2011 08:14
less.app in bash
#!/bin/bash
if [ ! -d $1 ]; then
echo "Not a directory: $1"
exit -1
fi
while read line; do
filename="$(basename $line)"
if [ "${filename##*.}" == "less" ]; then
@buritica
buritica / new_repo.rb
Created September 22, 2011 23:27
Create new folder, init repo, add readme.md, add remote origin, first commit, push to origin
#!/usr/bin/env ruby
# USAGE: sudo ./newrepo.rb folder_name origin_url
# Give it exec permissions before running: chmod +x init.rb
# Protip: add it to your ~/.profile or ~/.bash_profile, copy it to your ~/Scripts and run it from anywhere:
# alias new_repo="~/Scripts/new_repo.rb"
require 'fileutils'
@anabelle
anabelle / commands-to-find-malware.sh
Created December 16, 2011 02:17
Shell commands to help finding infections in website files
# files modified within 30 days.
find /home/mywebsite -type f -name "*.php" -ctime -30
# find for suspicious strings
find ./ -name "*.php" -type f | xargs sed -i 's#<?php /\*\*/ eval(base64_decode("aWY.*?>##g' 2>&1
find ./ -name "*.php" -type f | xargs sed -i '/./,$!d' 2>&1
# grep for suspicious and very long strings
grep -R "document.write(unescape" *
grep -iR --include "*.js" "[a-zA-Z0-9\/\+]\{255,\}" *
@anabelle
anabelle / sshadd.sh
Created December 25, 2011 01:58
add ssh key to server
# Agregar esto a .bashrc o a .bash_aliases
# Uso: add_ssh [email protected]
function add_ssh {
cat ~/.ssh/id_rsa.pub | ssh $1 'cat >> .ssh/authorized_keys'
}
export -f add_ssh
@Mantish
Mantish / sticky-title.js
Last active September 29, 2015 00:48
jQuery plugin to have divs stick to the top of the screen (or at some distance from the top), once scrolled by.
(function($)
{
$.fn.stickytitle = function(options)
{
var opts = $.extend($.fn.stickytitle.defaults, options);
var elements = this, starting_offsets = new Array();
elements.each(function(index){
//before anything happens, the original top offsets of each element are saved
starting_offsets[index] = $(this).offset().top;
});
find . -type d -print0 | xargs -0 chmod 0755 # For directories
find . -type f -print0 | xargs -0 chmod 0644 # For files
@anabelle
anabelle / update-wpdb.sql
Created May 11, 2012 06:04
Update WP database after migration to new domain
UPDATE wp_options SET option_value = replace(option_value, 'http://old.tld', 'http://new.tld') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old.tld','http://new.tld');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.tld', 'http://new.tld');
@ssoper
ssoper / app.js
Created June 19, 2012 21:43
Run Kue alongside another Express server using a different path
// Assumes you want to run a kue server on port 3001 with the path '/kue'.
// Use a proxy like nginx to send the requests to the appropriate URL.
require lodash = require('lodash'),
kue = require('kue');
// Prepend the Kue routes with '/kue'
lodash.each(['get', 'put', 'delete'], function(verb) {
lodash.each(kue.app.routes.routes[verb], function(route, index, routes) {
routes[index].path = '/kue' + route.path;
@carstingaxion
carstingaxion / ee2wp.export.xml
Created July 8, 2012 12:05
ExpressionEngine to WordPress Export Template
<?xml version="1.0" encoding="UTF-8" ?>
<!-- To import this information into a WordPress site follow these steps: -->
<!--RUN THIS FILE IN FIREFOX OR IE-->
<!--VIEW PAGE SOURCE-->
<!--COPY-PASTE PAGE SOURCE INTO TEXT EDITOR AND SAVE AS .WXR FILE-->
<!--REMOVE "?'s" FROM XML VERSION AT TOP OF THIS PAGE-->
<!--COMMENT OUT LINE 1309, 1310, 1311 IN wp-includes/kses.php -->
<!--THEN FOLLOW THE STEPS BELOW-->