Skip to content

Instantly share code, notes, and snippets.

@identityclash
identityclash / debian-increase-memory.sh
Created November 11, 2015 06:10 — forked from genediazjr/debian-increase-memory.sh
Increase Memory on Debian
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
mkswap /swapfile1
chown root:root /swapfile1
chmod 0600 /swapfile1
swapon /swapfile1
nano /etc/fstab
-----------------------------------------------------------------------------
/swapfile1 swap swap defaults 0 0
-----------------------------------------------------------------------------
@identityclash
identityclash / debian-change-ssh-port.sh
Created November 11, 2015 06:10
Change SSH Port on Debian
vim /etc/ssh/sshd_config
# Change Port 22 to a number you prefer
# Reboot machine
@identityclash
identityclash / sockjs-ws.js
Created November 11, 2015 06:10 — forked from genediazjr/sockjs-ws.js
Basic sockjs server and with ssl
var sockjs = require('sockjs');
var server = require('http').Server();
var socket = sockjs.createServer({sockjs_url: 'https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/0.3.4/sockjs.min.js'});
socket.on('connection', function (conn) {
console.log('new connection id:' + conn.id);
conn.on('close', function () {
console.log('connection closed id:' + conn.id);
});
@identityclash
identityclash / debian-update-timezone.sh
Created November 11, 2015 06:09
Modify the timezone on Debian
vim /etc/timezone
-----------------------------------------------------------------------------
Asia/Manila
-----------------------------------------------------------------------------
export TZ=Asia/Manila
@identityclash
identityclash / yyyyMMddHHmmssSSS_Timestamp.js
Created November 11, 2015 06:08 — forked from genediazjr/yyyyMMddHHmmssSSS_Timestamp.js
A simple yyyyMMddHHmmssSSS timestamp generator
function getTimestamp () {
var date = new Date();
var year = date.getFullYear();
var month = (date.getMonth() + 1) + '';
var day = date.getDate() + '';
var hr = date.getHours() + '';
var min = date.getMinutes() + '';
var sec = date.getSeconds() + '';
var ms = date.getMilliseconds() + '';
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
};
function guid() {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
@identityclash
identityclash / SerializeObject.js
Created November 11, 2015 06:08 — forked from genediazjr/SerializeObject.js
prepare form objects for JSON.stringify
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
<!-- Append to pom.xml -->
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>1.8</version>
</dependency>
<!-- Append to web.xml -->
<filter>
@identityclash
identityclash / .gitignore
Created November 11, 2015 06:08 — forked from genediazjr/.gitignore
Gitignore Preset
.DS_Store
.lock-wscript
.komodotools
.classpath
.settings
.project
.dropbox
.tmproj
.grunt
.cache
@identityclash
identityclash / deploy.sh
Created November 11, 2015 06:08 — forked from genediazjr/deploy.sh
Tomcat deployment script on Debian EC2
#!/bin/sh
echo "\n Killing the cat..."
/etc/init.d/tomcat7 stop
echo "\n Removing internal organs..."
rm -rf /var/lib/tomcat7/webapps/ROOT
rm -rf /var/lib/tomcat7/webapps/ROOT.war
echo "\n Placing new organs..."