Skip to content

Instantly share code, notes, and snippets.

View vanduc1102's full-sized avatar
🐛
💯 💯 💩 😆 🐢

Duke Nguyen vanduc1102

🐛
💯 💯 💩 😆 🐢
View GitHub Profile
@vanduc1102
vanduc1102 / cutvideo.sh
Last active August 29, 2015 14:22
Cut Video in Ubuntu
##cut a video from 00:00:00 to 00:25:00
ffmpeg -ss 00:00:00 -t 00:25:00 -i big-055.mp4 -acodec copy -vcodec copy 055.mp4
## another command
ffmpeg -i in.mp4 -ss [start] -t [duration] -c:v copy -c:a copy out.mp4
@vanduc1102
vanduc1102 / movie.json
Created June 17, 2015 12:11
movie object
{
"imdbId": "tt0100935",
"title": "Wild at Heart",
"year": "1990",
"rating": "7.3",
"description": "Young lovers Sailor and Lula run from the variety of weirdos that Lula's mom has hired to kill Sailor.",
"cast": [
"Nicolas Cage",
"Laura Dern",
"Willem Dafoe",
@vanduc1102
vanduc1102 / waitElementScope.js
Created September 22, 2015 09:32
wait until get element scope
if(!$scope.securityClassElementScope){
var watcher1 = $scope.$watch(function(){
return $element.find("#security-classes-multiple-search-and-select-edit-id").isolateScope();
},function(val){
if(val){
watcher1();
$scope.securityClassElementScope = val;
}
})
}
@vanduc1102
vanduc1102 / restartjboss.sh
Last active September 24, 2015 02:13
Batch forced restart Jboss on Linux
#!/bin/bash
# This batch created by follwed these documents
# 1. http://oracleflash.com/20/How-to-kill-all-processes-with-one-command-in-Linux.html
# 2. http://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/
#
echo "Start restart jboss"
kill -9 `ps aux | grep jboss | awk '$NF ~/jboss-as-7.1.1/ {print $2}'`
echo "Stopped jboss. Relax in 3 seconds."
sleep 3
echo "Start jboss"
@vanduc1102
vanduc1102 / web-config-auth.xml
Created September 24, 2015 11:41
web.xml config basic authentication
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>xedu-mongodb-web</display-name>
<!-- Auto scan REST service -->
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
@vanduc1102
vanduc1102 / Dependencies.xml
Last active October 10, 2015 18:57
Working with token and password in java
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
@vanduc1102
vanduc1102 / jboss_auto_deploy.sh
Last active October 14, 2015 12:54
Jboss auto deployement
// call jboss-cli
jboss-cli.sh --connect controller=vntils11:9991 --command="deploy /root/.hudson/jobs/Xframework-SaaS-EJB/workspace/xframework-saas-ear/target/xframework-saas-ear-1.0.0.0-SNAPSHOT.ear"
//relax
sleep 60
// copy to deployements
cp xframework-saas-ear/target/*ear /opt/jboss-as-7.1.1.Final/standalone/deployments/
{
"data": {
"distinguishedName": "CN=hr1,CN=Users",
"name": "hr1",
"certificateSerialNumber": null,
"companyName": "Apple Inc",
"secretAnswer": null,
"sendNewsLetter": null,
"unlockEmailCheckId": null,
"emergencyEmail": "2",
@vanduc1102
vanduc1102 / mongodb-basic-command.sh
Created January 8, 2016 09:34
MongoDB Basic Commands
# connect to mongodb with db name is xdsb
mongo xdsb
# show all collections
show collections()
# find by id
db.collection_name.find({_id:'id'})
@vanduc1102
vanduc1102 / Common.sql
Created September 29, 2015 02:09
This is common commands SQL
-- select top 5 rows
SELECT * FROM [framework_eventlog] WHERE [id] > (SELECT MAX([id]) - 5 FROM [framework_eventlog]);