Skip to content

Instantly share code, notes, and snippets.

@xiehekun
xiehekun / GetParamsFromPost
Created September 20, 2012 01:19
Fetch the json data from the HttpServletRequest
private String getParamsFromPost(HttpServletRequest request) throws IOException {
BufferedReader reader = request.getReader();
StringBuilder sb = new StringBuilder();
String line = reader.readLine();
while (line != null) {
sb.append(line + "\n");
line = reader.readLine();
}
reader.close();
String params = sb.toString();
@xiehekun
xiehekun / add_users_to_projects.sh
Created September 17, 2012 04:20 — forked from lanwin/add_users_to_projects.sh
Script to Automatically add all GitLab users to all projects
#!/bin/sh
baseurl=http://mygitlaburl
usermail=adminuser@mymailserver
userpass=adminpassword
repo_access=2 #0=denied 1=read 2=read&write
project_access=2 #0=deined 1=read 2=report 3=admin
# login
curl -s -I -c cookies.txt -d "utf8=✓&user[email]=$usermail&user[password]=$userpass&commit=Sign+in" $baseurl/users/sign_in