Skip to content

Instantly share code, notes, and snippets.

View andrask's full-sized avatar

Andras Kovi andrask

  • Budapest, Hungary
View GitHub Profile
@renyi
renyi / gist:1558477
Created January 4, 2012 04:23
python urlencode/urldecode
import urllib2
def urlencode(s):
return urllib2.quote(s)
def urldecode(s):
return urllib2.unquote(s).decode('utf8')
@makinde
makinde / arc_setup.sh
Created February 3, 2012 21:46
Arc Setup (Ubuntu)
#!/bin/bash
if ! hash git &> /dev/null || ! hash php &> /dev/null; then
echo -e " *****\n ***** INSTALLING GIT AND PHP\n *****"
if hash apt-get &> /dev/null; then
sudo apt-get install git-core php5-cli php5-curl
elif hash port &> /dev/null; then
sudo port install php5-curl
elif hash fink &> /dev/null; then
@ekantola
ekantola / RxJS-intro.js
Last active June 1, 2017 11:19
RxJS intro snippets
/*
* Observable
*/
var xs = Rx.Observable.range(0, 3)
xs.subscribe(log)
//=> 0
//=> 1
//=> 2
@elentok
elentok / script_dir.sh
Created May 9, 2013 11:33
Current script directory (works in bash and zsh)
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
SCRIPT_DIR=`cd $SCRIPT_DIR && pwd`
@hwellmann
hwellmann / pom-snippet.xml
Last active April 17, 2018 05:43
Integrating EMF code generation from an Ecore model into a Tycho build. Sources: my.ecore, my.genmodel, plugin.xml, META-INF/MANIFEST.MF. build.properties Generated Java sources end up in target/generated-sources/emf/src. This directory is included in build.properties as an additional source folder.
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
<!-- tested with 0.18 -->
<version>${tycho.version}</version>
<configuration>
<!-- linebreaks not permitted in this arg line -->
<appArgLine>-data target/workspace -application org.eclipse.emf.codegen.ecore.Generator -projects ${basedir} -model ${basedir}/model/my.genmodel target/generated-sources/emf</appArgLine>
<dependencies>
<dependency>
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@giefferre
giefferre / remote-rsyslog.go
Created March 31, 2015 23:16
Using a remote rsyslog in Golang
package main
import (
"log"
"log/syslog"
)
func main() {
logwriter, e := syslog.Dial("tcp","123.123.123.123:12345", syslog.LOG_DEBUG, "your.software.identifier")
if e != nil {
@tinkertims
tinkertims / install_byobu_on_centos7.sh
Last active February 26, 2024 05:44
Install byobu to CentOS 7
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
sudo yum install byobu -y --enablerepo=epel-testing
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"