Skip to content

Instantly share code, notes, and snippets.

@rollxx
rollxx / iter.sh
Last active September 26, 2018 11:25
iterate over json files
#!/usr/bin/env bash
for tenant in $(seq 1 12); do
input=sitemap-${tenant}.json
for i in $(seq 0 $(expr $(jq length ${input}) - 1 )); do
jq ".[$i]" -r ${input} > sitemap-${tenant}-${i}.json
done
done
@rollxx
rollxx / import_allocations.sql
Last active September 20, 2016 08:08
import allocation with extra temporal table to filter out the unneeded fields
CREATE TEMPORARY TABLE t (
location VARCHAR(255),
car_group_id SERIAL8,
start_timestamp TIMESTAMP WITH TIME ZONE,
end_timestamp TIMESTAMP WITH TIME ZONE,
ignore1 TEXT,
ignore2 TEXT,
ignore3 TEXT
);
@rollxx
rollxx / gist:7f5ccda0c0988d71d442
Created July 8, 2014 14:03
spring datasource config with default transaction isolation
<bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${db.driverClass}" />
<property name="url" value="${db.connectionURL}" />
<property name="username" value="${db.user.username}" />
<property name="password" value="${db.user.password}" />
<property name="validationQuery" value="${db.connection.validationQuery}"/>
<property name="testOnBorrow" value="${db.connection.testOnBorrow}"/>
<property name="defaultTransactionIsolation" value="2"/>
</bean>
@rollxx
rollxx / gist:9527467
Created March 13, 2014 12:26
workaround for XCode 5.1 clang feature, preventing mercurial from install (homebrew)
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
alter database datafile '/u01/app/oracle/oradata/XE/poslifeuk_data.dbf' resize 2048M;
@rollxx
rollxx / pom.xml
Created July 8, 2013 20:19
play! pom.xml
<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>com.rollxx.projects</groupId>
<artifactId>analyzer24</artifactId>
<version>1.0-SNAPSHOT</version>
<name>analyzer24</name>
<properties>
<play2.version>2.1.2</play2.version>
@rollxx
rollxx / gist:5803897
Created June 18, 2013 09:16
drop all oracle user tables, views...
BEGIN
FOR cur_rec IN (SELECT object_name, object_type
FROM user_objects
WHERE object_type IN
('TABLE',
'VIEW',
'PACKAGE',
'PROCEDURE',
'FUNCTION',
'SEQUENCE'
@rollxx
rollxx / gist:5763475
Created June 12, 2013 07:37
set global environment variables in Mac OS X
$ launchctl setenv MY_ENV_VAR /my/path
@rollxx
rollxx / gist:5134260
Last active May 12, 2017 02:58
Unload sync services. This is a workaround the weird behaviour of syncdefaultsd (100% CPU usage) when behind a proxy.
launchctl unload /System/Library/LaunchAgents/com.apple.syncdefaultsd.plist
launchctl unload /System/Library/LaunchAgents/com.apple.CalendarAgent.plist
launchctl unload /System/Library/LaunchAgents/com.apple.AddressBook.SourceSync.plist
@rollxx
rollxx / gist:4130325
Created November 22, 2012 10:00
remove duplicates from finder open with menu
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user