Skip to content

Instantly share code, notes, and snippets.

@ccarrasc
ccarrasc / my-service.service
Last active May 22, 2024 07:12
Install a Node.js service for systemctl on CentOS 7
[Unit]
After=network.target
[Service]
ExecStart=/usr/bin/node /var/node/my-service/app.js
#Type=forking
Restart=always
StandardOutput=syslog
TimeoutSec=90
SyslogIdentifier=my-service
@ccarrasc
ccarrasc / install-mongo.sh
Created January 16, 2015 15:38
Untested script with commands used for installing MongoDB on CentOS 7
#! /bin/bash
APPLICATION_IP="192.168.33.1/24"
REPLICA_SET="MyReplicaSet"
KEY_FILE_PATH="/etc/mongodb/keyfiles"
KEY_FILE="mongodb-keyfile"
# Make sure this is executed on CentOS 7
OS=`cat /etc/redhat-release | awk {'print $1$4}'`
if [ "$OS" != CentOS7* ]; then
@ccarrasc
ccarrasc / homebrew.mxcl.jenkins.plist
Created January 6, 2015 16:37
OSX LaunchDaemon for Jenkins CI (/System/Library/LaunchDaemons/homebrew.mxcl.jenkins.plist)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins</string>
<key>UserName</key>
<string>jenkins</string>
<key>Nice</key>
<integer>-10</integer>
@ccarrasc
ccarrasc / log4net.config.xml
Last active June 19, 2017 11:50
log4net UDP Appender to send signals to Graphite server
<appender name="GraphiteUdpAppender" type="log4net.Appender.UdpAppender">
<remoteAddress value="graphiteserver.somewhere.com"/>
<remotePort value="8125"/>
<layout type="log4net.Layout.PatternLayout">
<IgnoresException value="False"/>
<conversionPattern value="%property{log4net:HostName}.log4net.%level:1|kv\n"/>
</layout>
</appender>
<!-- Remember to add the appender to the root
@ccarrasc
ccarrasc / copy-row.sql
Created February 19, 2014 19:06
(MS) SQL example to copy a row in a table and replace the value in a specific column
INSERT INTO table (c1, c2, c3)
(SELECT 'new c1', c2, c3
FROM table
WHERE c1 = 'old c1')
@ccarrasc
ccarrasc / build-volley.ps1
Created December 13, 2013 13:01
Compile volley using PowerShell. Using application paths since I forget where I put shit on Windows :/
git clone https://android.googlesource.com/platform/frameworks/volley
cd .\volley
C:\Android\android-sdk\tools\android.bat update project -p .
$Env:JAVA_HOME = "C:\Program Files (x86)\Java\jdk1.6.0_45"
C:\Ant\apache-ant-1.9.2\bin\ant.bat jar
@ccarrasc
ccarrasc / node-bookmarks.xml
Last active December 27, 2015 01:09
Eclipse Software Site bookmarks for Node development: Window -> Preferences -> Install/Update -> Available Software Sites -> Import
<?xml version="1.0" encoding="UTF-8"?>
<bookmarks>
<site url="http://download.eclipse.org/egit/updates" selected="true" name="EGit"/>
<site url="https://svn.codespot.com/a/eclipselabs.org/jsdt-jquery/updatesite" selected="true" name="JSDT jQuery"/>
<site url="http://github.eclipsesource.com/jshint-eclipse/updates/" selected="true" name="JSHint"/>
<site url="https://sourceforge.net/projects/eclipsejsonedit/files/update" selected="true" name="JSON Editor"/>
<site url="http://dl.bintray.com/nodeclipse/nodeclipse/0.7.0/" selected="true" name="Nodeclipse"/>
</bookmarks>
@ccarrasc
ccarrasc / eclipse.ini
Last active December 25, 2015 16:39
.ini for Windows 7 + Eclipse Kepler + JDK 1.7.0_45
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
@ccarrasc
ccarrasc / postJSON.js
Created October 14, 2013 12:43
Serialize form input fields to JSON and POST with jQuery
// Using <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
var array = $('form').serializeArray();
var json = {};
$.each(array, function() {
json[this.name] = this.value || '';
});
$.ajax({
@ccarrasc
ccarrasc / centos_mongo.sh
Created September 9, 2013 17:37
Add repo and install MongoDb on CentOs
#!/bin/bash
# Create a repo for fetching Mongo
cat << 'EOF' > /etc/yum.repos.d/10gen.repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1
EOF