Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
janosgyerik / ssh-connection-multiplexing
Created April 29, 2012 07:07
Enable ssh connection multiplexing
# ~/.ssh/config
#
Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
@janosgyerik
janosgyerik / ssh-agent-setup
Created April 29, 2012 07:10
Setup ssh agent automatically on login
# ssh agent setup
SSH_ENV=$HOME/.ssh/env
start_ssh_agent() {
ssh-agent > $SSH_ENV
. $SSH_ENV
}
check_ssh_agent() {
@janosgyerik
janosgyerik / crc.c
Created May 3, 2012 17:03
crc implementation in c++
#include <stdio.h>
#include <stdint.h>
#include <string.h>
void crc8PushByte(uint8_t *crc, uint8_t ch) {
uint8_t i;
*crc = *crc ^ ch;
for (i=0; i<8; i++) {
@janosgyerik
janosgyerik / dot.gitconfig
Created May 14, 2012 13:34
My typical .gitconfig
[user]
name = Janos Gyerik
email = [email protected]
[alias]
st = status
ci = commit
br = branch
co = checkout
ls = ls-files
@janosgyerik
janosgyerik / Increase-JVM-heap-size.txt
Created May 15, 2012 15:06
Increase JVM heap size
java -Xms64m -Xmx256m -XX:MaxPermSize=128m HelloWorld
@janosgyerik
janosgyerik / log4j.properties
Created May 29, 2012 14:24
A very basic log4j.properties example
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} - %-5p %c{1} - %m%n
# 2012-05-18 15:58:39,210 - DEBUG CLASSNAME_WITHOUT_DOMAIN - LOGMESSAGE
@janosgyerik
janosgyerik / dump-foursquare-categories.py
Created June 10, 2012 19:05
Dump foursquare categories to a file in JSON format
#!/usr/bin/env python
#
# Notes:
#
# - python API home:
# https://github.com/mLewisLogic/foursquare
#
# - foursquare API home:
# https://developer.foursquare.com/
#
@janosgyerik
janosgyerik / passenger_wsgi.py
Last active May 8, 2020 08:42
passenger_wsgi.py for a django site
projectname = 'bashoneliners'
virtualenv_root = '/path/to/virtualenv/' + projectname
import sys
import os
INTERP = os.path.join(virtualenv_root, 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
@janosgyerik
janosgyerik / list-partitioner-test.md
Last active December 14, 2015 01:08
List partitioner test

  • Write a partition method that takes a list and size parameters and returns a list of sublists, where each sublist has at most size elements.

    Example inputs and outputs:

    • Example 1: partition([1,2,3,4,5], 2) returns: [ [1,2], [3,4], [5] ]
    • Example 2: partition([1,2,3,4,5], 3) returns: [ [1,2,3], [4,5] ]
  • Example 3: partition([1,2,3,4,5], 1) returns: [ [1], [2], [3], [4], [5] ]
-showlocation
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=the_ip_address
-Dhttp.proxyUser=the_username
#-Dhttp.proxyPassword=only_enter_temporarily_when_needed_and_remove_after
-Xms512m
-Xmx912m