Skip to content

Instantly share code, notes, and snippets.

View sydneyitguy's full-sized avatar

seb's sydneyitguy

  • Seoul, Korea
View GitHub Profile
@sydneyitguy
sydneyitguy / fuckjs.js
Created May 11, 2017 06:37
Fuck annoying JS preventers (Re-enable copy & paste / right-click functions on the webpage)
javascript:function r(d){d.oncontextmenu=null;d.onselectstart=null;d.ondragstart=null;d.onkeydown=null;d.onmousedown=null; d.body.oncontextmenu=null;d.body.onselectstart=null;d.body.ondragstart=null;d.body.onkeydown=null; d.body.onmousedown=null;};function unify(w){r(w.document);if(w.frames.length>0){for(var i=0;i<w.frames.length;i++){try{unify(w.frames[i].window);}catch(e){}};};}; unify(self);jQuery(document).unbind();jQuery('div, a, p, body, html, section').unbind();
@sydneyitguy
sydneyitguy / LocationActivity.java
Created July 10, 2016 07:47
Abstract class to extend for Google Play Fused Location Service
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
#!/bin/bash
#
# StackScript Bash Library
#
# Copyright (c) 2010 Linode LLC / Christopher S. Aker <caker@linode.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
@sydneyitguy
sydneyitguy / custom_modification
Created March 12, 2014 12:39
Finding custom modifications on Mac
1.
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}'
2.
{ sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix\.cron)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; echo; sudo defaults read com.apple.loginwindow LoginHook; echo; sudo crontab -l; } 2> /dev/null
3.
{ launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}'; echo; crontab -l 2> /dev/null; }
4.
@sydneyitguy
sydneyitguy / console.log
Created July 18, 2013 07:20
override console.log on old shit browsers
if(typeof(window.console) === 'undefined') {
window.console = {
log: function() {}
};
}
@sydneyitguy
sydneyitguy / osx_hack.sh
Last active December 17, 2015 07:29 — forked from DAddYE/hack.sh
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://gist.github.com/sydneyitguy/5572931/raw/osx_hack.sh)"
#
# or run it without prompt questions:
@sydneyitguy
sydneyitguy / _ebextension_default.config
Last active December 17, 2015 07:29 — forked from wicz/bootstrap.sh
Elastic Beanstalk issue & fixes
commands:
fix-01:
command: mkdir /var/app/ondeck/vendor /var/app/ondeck/public /var/app/support/bundle /var/app/support/assets /var/app/support/cache
fix-02:
command: ln -s /var/app/support/bundle /var/app/ondeck/vendor
fix-03:
command: ln -s /var/app/support/assets /var/app/ondeck/public
fix-04:
command: ln -s /var/app/support/cache /var/app/ondeck/vendor
fix-05:
@sydneyitguy
sydneyitguy / mongo
Last active December 15, 2015 23:39
mongo queries
db.getMongo().setSlaveOk()
db.currentOp()
db.killOp()
show dbs
show collections
db.events.find({event: 'view', date: { '$gte': 1338472800, '$lt': 1341064800 } }).count()
@sydneyitguy
sydneyitguy / _mysql_binary_log
Last active December 15, 2015 16:29
Purge / clear MySQL Bin Logs
vi /etc/my.cnf
log_bin = /usr/local/var/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
mysql.server restart
mysql -u root -e "PURGE BINARY LOGS BEFORE '2013-12-15 10:06:06';"
@sydneyitguy
sydneyitguy / _useful_bash_commands
Last active December 14, 2015 18:49
Clear all rails log files under the current directory
# Remove all Thumbs.db files reculsively from current directory
find ./ -name "Thumbs.db" -exec rm '{}' \;
# Restore default permissions
chmod 755 $(find ./ -type d) && chmod 644 $(find ./ -type f)