Skip to content

Instantly share code, notes, and snippets.

@anthavio
anthavio / WebappSpringConfig.java
Last active July 13, 2018 14:15
spring-security java exploded configuration
@Configuration
@PropertySource(CoreSpringConfig.PROPERTIES)
public class WebappSpringConfig {
@Autowired
private Environment environment;
/**
* 'springSecurityFilterChain' is Magic ID and it is required by Spring Security DelegatingFilterProxy in web.xml
*
@nwinkler
nwinkler / pom.xml
Last active March 25, 2023 20:49
Combining the git-flow branching model and the Maven Release Plugin to play nice. Based on info found here: http://vincent.demeester.fr/2012/07/maven-release-gitflow/
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>dummy</artifactId>
<name>Dummy Project</name>
<version>1.0.12</version>
<packaging>pom</packaging>
<scm>
<connection>scm:git:https://......</connection>
<tag>HEAD</tag>
@ahmozkya
ahmozkya / README.md
Last active July 2, 2025 01:46
Homebrew with DNSMasq + DNSCrypt-proxy (OpenDNS)
@chenzx
chenzx / 20131226-large-website-architecture.txt
Created December 26, 2013 10:34
大型网站技术架构:核心原理与案例分析
大型网站技术架构:核心原理与案例分析
跳转至: 导航、 搜索
p XI. 。。。但能在比较短的时间内解决这些技术问题,也说明了网站架构其实并不难,真正能解决问题的技术一定是简单的
大内存服务器作为分布式缓存
缓存预热、缓存穿透(请求不存在的数据?)
JBoss Cache
Memcached:TCP+文本命令?
基于Libevent
应用服务器集群+负载均衡
@dbeckham
dbeckham / carbon-cache.conf
Last active July 13, 2016 19:55
Graphite carbon-cache Upstart job - This upstart job attempts to duplicate the twistd configuration and command line options that carbon-cache.py uses, but will not daemonize so that an Ubuntu system can properly control carbon-cache. One caveat: the current version (as of 0.9.12) of the carbon code intentionally forces logging to STDOUT if the …
# carbon-cache-a upstart job
#
# Daniel Beckham
# @dbeckham
# https://github.com/dbeckham
#
# Tested with Graphite carbon tag v0.9.12 from:
# https://github.com/graphite-project/carbon
#
# Upstart config: /etc/init/carbon-cache-a.conf
@aleung
aleung / ActiveCountMetric.java
Created November 26, 2013 09:12
Invocation metric bases on codahale (Yammer) Metrics. 这是在Messaging性能测试时使用的metrics,记录了代码块调用的throughput(TPS,latency)和active count(并发数),数据每分钟写入csv格式文件。 用try + finally的方式对调用进行拦截检测,代码有侵入性。当时是测试使用,这样写起来最快。
public interface ActiveCountMetric {
void inc();
void dec();
}
@shrkw
shrkw / gunicorn_with_virtualenv
Created October 31, 2013 10:51
CentOS init script for Gunicorn with Virtualenv
#!/bin/sh
#
# gunicorn_sr Startup script for gunicorn for sr
#
# chkconfig: - 86 14
# processname: gunicorn
# pidfile:
# description: Python application server
#
### BEGIN INIT INFO
@jmason
jmason / TimerClearingGraphiteReporter.java
Last active November 30, 2023 19:27
TimerClearingGraphiteReporter.java
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.*;
import com.yammer.metrics.reporting.GraphiteReporter;
import com.yammer.metrics.reporting.SocketProvider;
import com.yammer.metrics.stats.Snapshot;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
@plentz
plentz / nginx.conf
Last active October 22, 2025 16:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mumrah
mumrah / ConcurrentCompositeConfigurationFactory.java
Created September 4, 2013 16:43
Example of configuring Archaius through Spring XML. Package names have been removed, so this probably won't work without some modification.
import org.apache.commons.configuration.AbstractConfiguration;
import com.netflix.config.ConcurrentCompositeConfiguration;
import java.util.ArrayList;
import java.util.List;
public class ConcurrentCompositeConfigurationFactory {
List<AbstractConfiguration> configs = new ArrayList<AbstractConfiguration>();
public void setConfigs(List<AbstractConfiguration> configs) {